/** * Writes a {@code TAG_Byte} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeByteTagPayload(ByteTag tag) throws IOException { os.writeByte(tag.getValue()); }
/** * Writes a {@code TAG_Byte} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeByteTagPayload(ByteTag tag) throws IOException { os.writeByte(tag.getValue()); }
/** * Writes a {@code TAG_Byte} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeByteTagPayload(ByteTag tag) throws IOException { os.writeByte(tag.getValue()); }
/** * Writes a {@code TAG_Compound} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeCompoundTagPayload(CompoundTag tag) throws IOException { for (Tag<?> childTag : tag.getValue().values()) { writeTag(childTag); } os.writeByte(TagType.TAG_END.getId()); // end tag - better way? }
/** * Writes a {@code TAG_Compound} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeCompoundTagPayload(CompoundTag tag) throws IOException { for (Tag<?> childTag : tag.getValue().values()) { writeTag(childTag); } os.writeByte(TagType.TAG_END.getId()); // end tag - better way? }
/** * Writes a {@code TAG_Compound} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ private void writeCompoundTagPayload(CompoundTag tag) throws IOException { for (Tag<?> childTag : tag.getValue().values()) { writeTag(childTag); } os.writeByte(TagType.TAG_END.getId()); // end tag - better way? }
/** * Writes a tag. * * @param tag The tag to write. * @throws java.io.IOException if an I/O error occurs. */ public void writeTag(Tag<?> tag) throws IOException { String name = tag.getName(); byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name()); os.writeByte(tag.getType().getId()); os.writeShort(nameBytes.length); os.write(nameBytes); if (tag.getType() == TagType.TAG_END) { throw new IOException("Named TAG_End not permitted."); } writeTagPayload(tag); }
/** * Writes a tag. * * @param tag The tag to write. * @throws java.io.IOException if an I/O error occurs. */ public void writeTag(Tag<?> tag) throws IOException { String name = tag.getName(); byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name()); os.writeByte(tag.getType().getId()); os.writeShort(nameBytes.length); os.write(nameBytes); if (tag.getType() == TagType.TAG_END) { throw new IOException("Named TAG_End not permitted."); } writeTagPayload(tag); }
/** * Writes a tag. * * @param tag The tag to write. * @throws java.io.IOException if an I/O error occurs. */ public void writeTag(Tag<?> tag) throws IOException { String name = tag.getName(); byte[] nameBytes = name.getBytes(NBTConstants.CHARSET.name()); os.writeByte(tag.getType().getId()); os.writeShort(nameBytes.length); os.write(nameBytes); if (tag.getType() == TagType.TAG_END) { throw new IOException("Named TAG_End not permitted."); } writeTagPayload(tag); }
/** * Writes a {@code TAG_List} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ @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); } }
/** * Writes a {@code TAG_List} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ @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); } }
/** * Writes a {@code TAG_List} tag. * * @param tag The tag. * @throws java.io.IOException if an I/O error occurs. */ @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); } }