C# Class fNbt.NbtFile

Represents a complete NBT file.
Mostrar archivo Open project: fragmer/fNbt Class Usage Examples

Private Properties

Property Type Description
DetectCompression NbtCompression
GetRootNameInternal string
LoadFromStreamInternal void
NbtFile System
ReadRootTagName string
ReadRootTagName string
SaveToBuffer byte[]
ToString string

Public Methods

Method Description
LoadFromBuffer ( [ buffer, int index, int length, NbtCompression compression ) : long

Loads NBT data from a byte array. Existing RootTag will be replaced. FileName will be set to null.

LoadFromBuffer ( [ buffer, int index, int length, NbtCompression compression, [ selector ) : long

Loads NBT data from a byte array. Existing RootTag will be replaced. FileName will be set to null.

LoadFromFile ( [ fileName ) : long

Loads NBT data from a file. Existing RootTag will be replaced. Compression will be auto-detected.

LoadFromFile ( [ fileName, NbtCompression compression, [ selector ) : long

Loads NBT data from a file. Existing RootTag will be replaced.

LoadFromStream ( [ stream, NbtCompression compression ) : long

Loads NBT data from a stream. Existing RootTag will be replaced

LoadFromStream ( [ stream, NbtCompression compression, [ selector ) : long

Loads NBT data from a stream. Existing RootTag will be replaced

NbtFile ( [ rootTag ) : System

Creates a new NBT file with the given root tag.

SaveToBuffer ( [ buffer, int index, NbtCompression compression ) : long

Saves this NBT file to a stream. Nothing is written to stream if RootTag is null.

SaveToFile ( [ fileName, NbtCompression compression ) : long

Saves this NBT file to a stream. Nothing is written to stream if RootTag is null.

SaveToStream ( [ stream, NbtCompression compression ) : long

Saves this NBT file to a stream. Nothing is written to stream if RootTag is null.

ToString ( ) : string

Prints contents of the root tag, and any child tags, to a string.

Private Methods

Method Description
DetectCompression ( [ stream ) : NbtCompression
GetRootNameInternal ( [ stream, bool bigEndian ) : string
LoadFromStreamInternal ( [ stream, [ tagSelector ) : void
NbtFile ( ) : System
ReadRootTagName ( [ fileName ) : string
ReadRootTagName ( [ fileName, NbtCompression compression, bool bigEndian, int bufferSize ) : string
SaveToBuffer ( NbtCompression compression ) : byte[]
ToString ( [ indentString ) : string

Method Details

LoadFromBuffer() public method

Loads NBT data from a byte array. Existing RootTag will be replaced. FileName will be set to null.
is null. If an unrecognized/unsupported value was given for ; /// if or is less than zero; /// if the sum of and is greater than the length of . If NBT stream extends beyond the given . If file compression could not be detected or decompressing failed. If an error occurred while parsing data in NBT format.
public LoadFromBuffer ( [ buffer, int index, int length, NbtCompression compression ) : long
buffer [ Stream from which data will be loaded. If is set to AutoDetect, this stream must support seeking.
index int The index into at which the stream begins. Must not be negative.
length int Maximum number of bytes to read from the given buffer. Must not be negative. /// An is thrown if NBT stream is longer than the given length.
compression NbtCompression Compression method to use for loading/saving this file.
return long

LoadFromBuffer() public method

Loads NBT data from a byte array. Existing RootTag will be replaced. FileName will be set to null.
is null. If an unrecognized/unsupported value was given for ; /// if or is less than zero; /// if the sum of and is greater than the length of . If NBT stream extends beyond the given . If file compression could not be detected or decompressing failed. If an error occurred while parsing data in NBT format.
public LoadFromBuffer ( [ buffer, int index, int length, NbtCompression compression, [ selector ) : long
buffer [ Stream from which data will be loaded. If is set to AutoDetect, this stream must support seeking.
index int The index into at which the stream begins. Must not be negative.
length int Maximum number of bytes to read from the given buffer. Must not be negative. /// An is thrown if NBT stream is longer than the given length.
compression NbtCompression Compression method to use for loading/saving this file.
selector [ Optional callback to select which tags to load into memory. Root may not be skipped. /// No reference is stored to this callback after loading (don't worry about implicitly captured closures). May be null.
return long

LoadFromFile() public method

Loads NBT data from a file. Existing RootTag will be replaced. Compression will be auto-detected.
is null. If given file was not found. If file ended earlier than expected. If file compression could not be detected, or decompressing failed. If an error occurred while parsing data in NBT format. If an I/O error occurred while reading the file.
public LoadFromFile ( [ fileName ) : long
fileName [ Name of the file from which data will be loaded.
return long

LoadFromFile() public method

Loads NBT data from a file. Existing RootTag will be replaced.
is null. If an unrecognized/unsupported value was given for . If given file was not found. If file ended earlier than expected. If file compression could not be detected, or decompressing failed. If an error occurred while parsing data in NBT format. If an I/O error occurred while reading the file.
public LoadFromFile ( [ fileName, NbtCompression compression, [ selector ) : long
fileName [ Name of the file from which data will be loaded.
compression NbtCompression Compression method to use for loading/saving this file.
selector [ Optional callback to select which tags to load into memory. Root may not be skipped. /// No reference is stored to this callback after loading (don't worry about implicitly captured closures). May be null.
return long

LoadFromStream() public method

Loads NBT data from a stream. Existing RootTag will be replaced
is null. If an unrecognized/unsupported value was given for . If is set to AutoDetect, but the stream is not seekable. If file ended earlier than expected. If file compression could not be detected, decompressing failed, or given stream does not support reading. If an error occurred while parsing data in NBT format.
public LoadFromStream ( [ stream, NbtCompression compression ) : long
stream [ Stream from which data will be loaded. If compression is set to AutoDetect, this stream must support seeking.
compression NbtCompression Compression method to use for loading/saving this file.
return long

LoadFromStream() public method

Loads NBT data from a stream. Existing RootTag will be replaced
is null. If an unrecognized/unsupported value was given for . If is set to AutoDetect, but the stream is not seekable. If file ended earlier than expected. If file compression could not be detected, decompressing failed, or given stream does not support reading. If an error occurred while parsing data in NBT format.
public LoadFromStream ( [ stream, NbtCompression compression, [ selector ) : long
stream [ Stream from which data will be loaded. If compression is set to AutoDetect, this stream must support seeking.
compression NbtCompression Compression method to use for loading/saving this file.
selector [ Optional callback to select which tags to load into memory. Root may not be skipped. /// No reference is stored to this callback after loading (don't worry about implicitly captured closures). May be null.
return long

NbtFile() public method

Creates a new NBT file with the given root tag.
If given is unnamed.
public NbtFile ( [ rootTag ) : System
rootTag [ Compound tag to set as the root tag. May be null.
return System

SaveToBuffer() public method

Saves this NBT file to a stream. Nothing is written to stream if RootTag is null.
is null. If AutoDetect was given as the mode. If an unrecognized/unsupported value was given for ; /// if is less than zero; or if is greater than the length of . If given stream does not support writing. Specified file is read-only, or a permission issue occurred. If one of the NbtCompound tags contained unnamed tags; /// or if an NbtList tag had Unknown list type and no elements.
public SaveToBuffer ( [ buffer, int index, NbtCompression compression ) : long
buffer [ Buffer to write data to. May not be null.
index int The index into at which the stream should begin.
compression NbtCompression Compression mode to use for saving. May not be AutoDetect.
return long

SaveToFile() public method

Saves this NBT file to a stream. Nothing is written to stream if RootTag is null.
is null. If AutoDetect was given as the mode. If an unrecognized/unsupported value was given for . If given stream does not support writing. If an I/O error occurred while creating the file. Specified file is read-only, or a permission issue occurred. If one of the NbtCompound tags contained unnamed tags; /// or if an NbtList tag had Unknown list type and no elements.
public SaveToFile ( [ fileName, NbtCompression compression ) : long
fileName [ File to write data to. May not be null.
compression NbtCompression Compression mode to use for saving. May not be AutoDetect.
return long

SaveToStream() public method

Saves this NBT file to a stream. Nothing is written to stream if RootTag is null.
is null. If AutoDetect was given as the mode. If an unrecognized/unsupported value was given for . If given stream does not support writing. If RootTag is null; /// or if RootTag is unnamed; /// or if one of the NbtCompound tags contained unnamed tags; /// or if an NbtList tag had Unknown list type and no elements.
public SaveToStream ( [ stream, NbtCompression compression ) : long
stream [ Stream to write data to. May not be null.
compression NbtCompression Compression mode to use for saving. May not be AutoDetect.
return long

ToString() public method

Prints contents of the root tag, and any child tags, to a string.
public ToString ( ) : string
return string