Writes a {@code TAG_String} tag.

@param tag The tag.
@throws java.io.IOException if an I/O error occurs.
969411
private void writeStringTagPayload(StringTag tag) throws IOException {
        byte[] bytes = tag.getValue().getBytes(NBTConstants.CHARSET.name());
        os.writeShort(bytes.length);
        os.write(bytes);
    }
933796
public void writeTags(Writer writer, boolean useLemmas, boolean useNormNer, boolean useNerTags) throws IOException {
        for (int i=0; i<tokens.size(); i++) {
            AgigaToken tok = tokens.get(i);
            if (useNormNer && tok.getNormNer() != null) {
                require(prefs.readNormNer, 
                        "AgigaPrefs.readNormNer must be true if useNormNer=true for writeTags()");
                writer.write(tok.getNormNer());
            } else if (useLemmas) {
                require(prefs.readLemma, 
                        "AgigaPrefs.readLemma must be true if useLemmas=true for writeTags()");
                writer.write(tok.getLemma());
            } else {
                require(prefs.readWord, 
                        "AgigaPrefs.readWord must be true if useLemmas and useNormNer are false for writeTags()");
                writer.write(tok.getWord());                
            }
            writer.write("/");
            if (useNerTags) {
                require(prefs.readNer,
                        "AgigaPrefs.readNer must be true if useNerTags=true for writeTags()");
                if (prefs.strict) { 
                    writer.write(tok.getNerTag());
                } else {
                    if (tok.getNerTag() != null) {
                        writer.write(tok.getNerTag());
                    } else {
                        log.warning("Missing NER annotation written as '__MISSING_NER_ANNOTATION__'");
                        writer.write("__MISSING_NER_ANNOTATION__");
                    }
                }
            } else {
                require(prefs.readPos,
                        "AgigaPrefs.readPos must be true if useNerTags=false for writeTags()");
                writer.write(tok.getPosTag());
            }
            if (i < tokens.size()-1) {
                writer.write(" ");
            }
        }
        writer.write("\n");
    }
1265780
def serialize(self, tag):
        """"""
        try:
            tag.serialize(self)
        except (AttributeError, TypeError):
            self.write(str(tag))
569440
public static void setTag(String tag) {
        d("Changing log tag to %s", tag);
        TAG = tag;

        // Reinitialize the DEBUG "constant"
        DEBUG = Log.isLoggable(TAG, Log.VERBOSE);
    }
465316
def write_tag(tag)
      # Group 0002 is always little endian, but the rest of the file may be little or big endian.
      # When we shift from group 0002 to another group we need to update our endian/explicitness variables:
      switch_syntax_on_write if tag.group != META_GROUP and @switched == false
      # Write to binary string:
      bin_tag = @stream.encode_tag(tag)
      add_encoded(bin_tag)
    end
766513
@SuppressWarnings ("unchecked")
    private void writeListTagPayload(ListTag<?> tag) throws IOException {
        Class<? extends Tag<?>> clazz = tag.getElementType();
        List<Tag<?>> tags = (List<Tag<?>>) tag.getValue();
        int size = tags.size();

        os.writeByte(TagType.getByTagClass(clazz).getId());
        os.writeInt(size);
        for (Tag<?> tag1 : tags) {
            writeTagPayload(tag1);
        }
    }
355866
public static void setLogTag(final String logTag) {
        Logger.logTag = TextUtils.isEmpty(logTag) ? LOG_TAG : logTag;
    }
1281882
public void writeTags() throws FileNotFoundException, IOException
	{
		RandomAccessFile raf = null;
		try
		{
			raf = new RandomAccessFile(mp3File, "rw");
			// Write out id3v2 first because if the filesize is changed when an
			// id3v2 is written then the id3v1 may be moved away from the end
			// of the file which would cause it to not be recognized.
			if (id3v2.tagExists())
			{
				id3v2.writeTag(raf);
			}
			if (id3v1.tagExists())
			{
				id3v1.writeTag(raf);
			}
		}
		finally
		{
			if (raf != null) raf.close();
		}
	}
1015736
public void setTag(String tag) throws IllegalArgumentException {
		if (tag == null
				|| (tag != null && (tag.length() < 1 || tag.length() > 32))) {
			throw new IllegalArgumentException(
					"The tag must not be null, the length between 1..32");
		}

		this.tag = tag;
	}
152777
protected void appendInputTag(String tag) {
        final TagView previousInputTag = getInputTag();
        if (previousInputTag != null) {
            throw new IllegalStateException("Already has a INPUT tag in group.");
        }

        final TagView newInputTag = new TagView(getContext(), TagView.STATE_INPUT, tag);
        newInputTag.setOnClickListener(mInternalTagClickListener);
        addView(newInputTag);
    }
244039
private static int encodeTag(Tag tag, StringBuilder stringBuilder) {
    String key = tag.getKey().getName();
    String value = tag.getValue().asString();
    int charsOfTag = key.length() + value.length();
    // This should never happen with our current constraints (<= 255 chars) on tags.
    checkArgument(
        charsOfTag <= TAG_SERIALIZED_SIZE_LIMIT,
        "Serialized size of tag " + tag + " exceeds limit " + TAG_SERIALIZED_SIZE_LIMIT);

    // TODO(songy23): do we want to encode TagMetadata?
    stringBuilder.append(key).append(TAG_KEY_VALUE_DELIMITER).append(value);
    return charsOfTag;
  }
234209
public void addClassTag (String tag, Class type) {
		tagToClass.put(tag, type);
		classToTag.put(type, tag);
	}
1332542
public static void writeFile(CompoundTag tag, String path) throws IOException {
        writeFile(tag, new File(path));
    }
667190
private final void write(byte dataType, int timestamp, ITag tag) {
        if (tag != null) {
            // only allow blank tags if they are of audio type
            if (tag.getBodySize() > 0 || dataType == ITag.TYPE_AUDIO) {
                try {
                    if (timestamp >= 0) {
                        if (!writer.writeTag(tag)) {
                            log.warn("Tag was not written");
                        }
                    } else {
                        log.warn("Skipping message with negative timestamp");
                    }
                } catch (ClosedChannelException cce) {
                    // the channel we tried to write to is closed, we should not try again on that writer
                    log.error("The writer is no longer able to write to the file: {} writable: {}", path.getFileName(), path.toFile().canWrite());
                } catch (IOException e) {
                    log.warn("Error writing tag", e);
                    if (e.getCause() instanceof ClosedChannelException) {
                        // the channel we tried to write to is closed, we should not try again on that writer
                        log.error("The writer is no longer able to write to the file: {} writable: {}", path.getFileName(), path.toFile().canWrite());
                    }
                }
            }
        }
    }
680279
public void writeElement(StringBuffer buffer, String tag, String content) {

        buffer.append("<" + tag + ">");
        buffer.append(CmsEncoder.escapeXml(content));
        buffer.append("</" + tag + ">");
    }
404528
public void setTags(java.util.Map<String, String> tags) {
        this.tags = tags == null ? null : new com.amazonaws.internal.SdkInternalMap<String, String>(tags);
    }
666390
public static StringBuffer appendClosingTag(StringBuffer buffer, String tag)
	{
		StringBuffer _buffer = initStringBufferIfNecessary(buffer);
		return doAppendClosingTag(_buffer, tag);
	}