Java Code Examples for cn.nukkit.nbt.tag.Tag#writeNamedTag()

The following examples show how to use cn.nukkit.nbt.tag.Tag#writeNamedTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NBTIO.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] write(CompoundTag tag, ByteOrder endianness, boolean network) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (NBTOutputStream stream = new NBTOutputStream(baos, endianness, network)) {
        Tag.writeNamedTag(tag, stream);
        return baos.toByteArray();
    }
}
 
Example 2
Source File: NBTIO.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] write(Collection<CompoundTag> tags, ByteOrder endianness, boolean network) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try (NBTOutputStream stream = new NBTOutputStream(baos, endianness, network)) {
        for (CompoundTag tag : tags) {
            Tag.writeNamedTag(tag, stream);
        }
        return baos.toByteArray();
    }
}
 
Example 3
Source File: NBTIO.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] write(Tag tag, ByteOrder endianness, boolean network) throws IOException {
    FastByteArrayOutputStream baos = ThreadCache.fbaos.get().reset();
    try (NBTOutputStream stream = new NBTOutputStream(baos, endianness, network)) {
        Tag.writeNamedTag(tag, stream);
        return baos.toByteArray();
    }
}
 
Example 4
Source File: NBTIO.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] write(Collection<CompoundTag> tags, ByteOrder endianness, boolean network) throws IOException {
    FastByteArrayOutputStream baos = ThreadCache.fbaos.get().reset();
    try (NBTOutputStream stream = new NBTOutputStream(baos, endianness, network)) {
        for (CompoundTag tag : tags) {
            Tag.writeNamedTag(tag, stream);
        }
        return baos.toByteArray();
    }
}
 
Example 5
Source File: NBTIO.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] writeNetwork(Tag tag) throws IOException {
    FastByteArrayOutputStream baos = ThreadCache.fbaos.get().reset();
    try (NBTOutputStream stream = new NBTOutputStream(baos, ByteOrder.LITTLE_ENDIAN, true)) {
        Tag.writeNamedTag(tag, stream);
    }
    return baos.toByteArray();
}
 
Example 6
Source File: NBTIO.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] write(CompoundTag tag, ByteOrder endianness, boolean network) throws IOException {
    FastByteArrayOutputStream baos = ThreadCache.fbaos.get().reset();
    try (NBTOutputStream stream = new NBTOutputStream(baos, endianness, network)) {
        Tag.writeNamedTag(tag, stream);
        return baos.toByteArray();
    }
}
 
Example 7
Source File: NBTIO.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] write(Collection<CompoundTag> tags, ByteOrder endianness, boolean network) throws IOException {
    FastByteArrayOutputStream baos = ThreadCache.fbaos.get().reset();
    try (NBTOutputStream stream = new NBTOutputStream(baos, endianness, network)) {
        for (CompoundTag tag : tags) {
            Tag.writeNamedTag(tag, stream);
        }
        return baos.toByteArray();
    }
}
 
Example 8
Source File: NBTIO.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public static void write(CompoundTag tag, OutputStream outputStream, ByteOrder endianness, boolean network) throws IOException {
    try (NBTOutputStream stream = new NBTOutputStream(outputStream, endianness, network)) {
        Tag.writeNamedTag(tag, stream);
    }
}
 
Example 9
Source File: NBTIO.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public static void write(CompoundTag tag, OutputStream outputStream, ByteOrder endianness, boolean network) throws IOException {
    try (NBTOutputStream stream = new NBTOutputStream(outputStream, endianness, network)) {
        Tag.writeNamedTag(tag, stream);
    }
}
 
Example 10
Source File: NBTIO.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public static void write(CompoundTag tag, OutputStream outputStream, ByteOrder endianness, boolean network) throws IOException {
    try (NBTOutputStream stream = new NBTOutputStream(outputStream, endianness, network)) {
        Tag.writeNamedTag(tag, stream);
    }
}