Class NBTFileHandler
java.lang.Object
de.pauleff.formats.binary.NBTFileHandler
Class for managing the loading and conversion of a given NBT file to the desired stream.
- Author:
- Paul Ferlitz
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Compression_TypesgetCompressionType(File file) Method to get the compression type of a file.static DataInputStreamloadNBTToReader(File file) Method to fully load a NBT file and return it as aDataInputStream.static DataOutputStreamloadNBTToWriter(File file, Compression_Types compression) Method to create aDataOutputStreamto later write a NBT file.
-
Constructor Details
-
NBTFileHandler
public NBTFileHandler()
-
-
Method Details
-
loadNBTToReader
Method to fully load a NBT file and return it as aDataInputStream.- Parameters:
file- The target file.- Returns:
- The file as
DataInputStream. - Throws:
IOException- When encountering an error whilst reading the file to aDataInputStream.
-
loadNBTToWriter
public static DataOutputStream loadNBTToWriter(File file, Compression_Types compression) throws IOException Method to create aDataOutputStreamto later write a NBT file. If the file already exists, a backup will be created.- Parameters:
file- The target file.compression- The compression type of the file.- Returns:
- The file as
DataOutputStream. - Throws:
IOException- When encountering an error whilst reading the file to aDataOutputStream.
-
getCompressionType
Method to get the compression type of a file.- Parameters:
file- The target file.- Returns:
- The compression type of the file.
-