Package cn.nukkit.nbt
Class NBTIO
java.lang.Object
cn.nukkit.nbt.NBTIO
@PowerNukkitDifference(since="1.4.0.0-PN",info="Fixed resource leaks") @PowerNukkitDifference(since="1.4.0.0-PN",info="It\'s the caller responsibility to close the provided streams") @PowerNukkitDifference(since="1.4.0.0-PN",info="Fixed output streams not being finished correctly") @PowerNukkitDifference(since="1.4.0.0-PN",info="Added defensive close invocations to byte array streams")
public class NBTIO
extends Object
A Named Binary Tag library for Nukkit Project
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Item
getItemHelper
(CompoundTag tag) static CompoundTag
putItemHelper
(Item item) static CompoundTag
putItemHelper
(Item item, Integer slot) static CompoundTag
read
(byte[] data) static CompoundTag
static CompoundTag
static CompoundTag
static CompoundTag
static CompoundTag
read
(InputStream inputStream) static CompoundTag
read
(InputStream inputStream, ByteOrder endianness) static CompoundTag
read
(InputStream inputStream, ByteOrder endianness, boolean network) static CompoundTag
readCompressed
(byte[] data) static CompoundTag
readCompressed
(byte[] data, ByteOrder endianness) static CompoundTag
readCompressed
(InputStream inputStream) static CompoundTag
readCompressed
(InputStream inputStream, ByteOrder endianness) static CompoundTag
readNetworkCompressed
(byte[] data) static CompoundTag
readNetworkCompressed
(byte[] data, ByteOrder endianness) static CompoundTag
readNetworkCompressed
(InputStream inputStream) static CompoundTag
readNetworkCompressed
(InputStream inputStream, ByteOrder endianness) static Tag
readTag
(InputStream inputStream, ByteOrder endianness, boolean network) static void
safeWrite
(CompoundTag tag, File file) static byte[]
write
(CompoundTag tag) static void
write
(CompoundTag tag, File file) static void
write
(CompoundTag tag, File file, ByteOrder endianness) static void
write
(CompoundTag tag, OutputStream outputStream) static void
write
(CompoundTag tag, OutputStream outputStream, ByteOrder endianness) static void
write
(CompoundTag tag, OutputStream outputStream, ByteOrder endianness, boolean network) static byte[]
write
(CompoundTag tag, ByteOrder endianness) static byte[]
write
(CompoundTag tag, ByteOrder endianness, boolean network) static byte[]
static byte[]
write
(Collection<CompoundTag> tags) static byte[]
write
(Collection<CompoundTag> tags, ByteOrder endianness) static byte[]
write
(Collection<CompoundTag> tags, ByteOrder endianness, boolean network) static byte[]
static void
writeGZIPCompressed
(CompoundTag tag, OutputStream outputStream) static void
writeGZIPCompressed
(CompoundTag tag, OutputStream outputStream, ByteOrder endianness) static byte[]
writeGZIPCompressed
(CompoundTag tag, ByteOrder endianness) static byte[]
writeNetwork
(Tag tag) static byte[]
static void
writeNetworkGZIPCompressed
(CompoundTag tag, OutputStream outputStream) static void
writeNetworkGZIPCompressed
(CompoundTag tag, OutputStream outputStream, ByteOrder endianness) static byte[]
writeNetworkGZIPCompressed
(CompoundTag tag, ByteOrder endianness) static void
writeZLIBCompressed
(CompoundTag tag, OutputStream outputStream) static void
writeZLIBCompressed
(CompoundTag tag, OutputStream outputStream, int level) static void
writeZLIBCompressed
(CompoundTag tag, OutputStream outputStream, int level, ByteOrder endianness) static void
writeZLIBCompressed
(CompoundTag tag, OutputStream outputStream, ByteOrder endianness)
-
Constructor Details
-
NBTIO
public NBTIO()
-
-
Method Details
-
putItemHelper
-
putItemHelper
-
getItemHelper
-
read
- Throws:
IOException
-
read
- Throws:
IOException
-
read
- Throws:
IOException
-
read
- Throws:
IOException
-
read
public static CompoundTag read(InputStream inputStream, ByteOrder endianness, boolean network) throws IOException - Throws:
IOException
-
readTag
public static Tag readTag(InputStream inputStream, ByteOrder endianness, boolean network) throws IOException - Throws:
IOException
-
read
- Throws:
IOException
-
read
- Throws:
IOException
-
read
public static CompoundTag read(byte[] data, ByteOrder endianness, boolean network) throws IOException - Throws:
IOException
-
readCompressed
- Throws:
IOException
-
readCompressed
public static CompoundTag readCompressed(InputStream inputStream, ByteOrder endianness) throws IOException - Throws:
IOException
-
readCompressed
- Throws:
IOException
-
readCompressed
- Throws:
IOException
-
readNetworkCompressed
- Throws:
IOException
-
readNetworkCompressed
public static CompoundTag readNetworkCompressed(InputStream inputStream, ByteOrder endianness) throws IOException - Throws:
IOException
-
readNetworkCompressed
- Throws:
IOException
-
readNetworkCompressed
public static CompoundTag readNetworkCompressed(byte[] data, ByteOrder endianness) throws IOException - Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
write
public static byte[] write(CompoundTag tag, ByteOrder endianness, boolean network) throws IOException - Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
write
public static byte[] write(Collection<CompoundTag> tags, ByteOrder endianness, boolean network) throws IOException - Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
write
public static void write(CompoundTag tag, OutputStream outputStream, ByteOrder endianness) throws IOException - Throws:
IOException
-
write
public static void write(CompoundTag tag, OutputStream outputStream, ByteOrder endianness, boolean network) throws IOException - Throws:
IOException
-
writeNetwork
- Throws:
IOException
-
writeGZIPCompressed
- Throws:
IOException
-
writeGZIPCompressed
- Throws:
IOException
-
writeGZIPCompressed
public static void writeGZIPCompressed(CompoundTag tag, OutputStream outputStream) throws IOException - Throws:
IOException
-
writeGZIPCompressed
public static void writeGZIPCompressed(CompoundTag tag, OutputStream outputStream, ByteOrder endianness) throws IOException - Throws:
IOException
-
writeNetworkGZIPCompressed
- Throws:
IOException
-
writeNetworkGZIPCompressed
public static byte[] writeNetworkGZIPCompressed(CompoundTag tag, ByteOrder endianness) throws IOException - Throws:
IOException
-
writeNetworkGZIPCompressed
public static void writeNetworkGZIPCompressed(CompoundTag tag, OutputStream outputStream) throws IOException - Throws:
IOException
-
writeNetworkGZIPCompressed
public static void writeNetworkGZIPCompressed(CompoundTag tag, OutputStream outputStream, ByteOrder endianness) throws IOException - Throws:
IOException
-
writeZLIBCompressed
public static void writeZLIBCompressed(CompoundTag tag, OutputStream outputStream) throws IOException - Throws:
IOException
-
writeZLIBCompressed
public static void writeZLIBCompressed(CompoundTag tag, OutputStream outputStream, ByteOrder endianness) throws IOException - Throws:
IOException
-
writeZLIBCompressed
public static void writeZLIBCompressed(CompoundTag tag, OutputStream outputStream, int level) throws IOException - Throws:
IOException
-
writeZLIBCompressed
public static void writeZLIBCompressed(CompoundTag tag, OutputStream outputStream, int level, ByteOrder endianness) throws IOException - Throws:
IOException
-
safeWrite
- Throws:
IOException
-