Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Type
- data Nbt b = Nbt {}
- type Nbt' = Nbt ()
- type MapNbt = Nbt (Map Text Int)
- data Tag b
- type Tag' = Tag ()
- type MapTag = Tag (Map Text Int)
- data Cmpnd b = Cmpnd b (Vector (Nbt b))
- type Cmpnd' = Cmpnd ()
- type MapCmpnd = Cmpnd (Map Text Int)
- pattern Compound' :: Vector Nbt' -> Tag'
- lookupNbt :: Text -> MapCmpnd -> Maybe MapNbt
- getNbt :: Text -> MapCmpnd -> MapNbt
- lookupTag :: Text -> MapCmpnd -> Maybe MapTag
- getTag :: Text -> MapCmpnd -> MapTag
- typeOf :: Tag b -> Type
- readUncompressed :: Serialize (Nbt b) => FilePath -> IO (Either String (Nbt b))
- writeUncompressed :: Serialize (Nbt b) => FilePath -> Nbt b -> IO ()
- readCompressed :: Serialize (Nbt b) => FilePath -> IO (Either String (Nbt b))
- writeCompressed :: Serialize (Nbt b) => FilePath -> Nbt b -> IO ()
Documentation
An NBT tag type, in order so that toEnum
and fromEnum
are useful for serialization and
deserialization.
EndType | 0x00 NUL. Denotes the end of a file. |
ByteType | 0x01 SOH. Corresponds to |
ShortType | 0x02 STX. Corresponds to |
IntType | 0x03 ETX. Corresponds to |
LongType | 0x04 EOT. Corresponds to |
FloatType | 0x05 ENQ. Corresponds to |
DoubleType | 0x06 ACK. Corresponds to |
ByteArrayType | 0x07 BEL. Corresponds to |
StringType | 0x08 BS. Corresponds to |
ListType | 0x09 HT. Corresponds to |
CompoundType | 0x0a LF. Corresponds to |
IntArrayType | 0x0b VT. Corresponds to |
LongArrayType | 0x0c FF. Corresponds to |
The main NBT type, with support for serialization and deserialization. It couples a Text
label with a Tag
.
When serialized: 1-byte unsigned Type
+ 2-byte unsigned integer length + N bytes utf-8 text + Tag
type MapNbt = Nbt (Map Text Int) Source #
A version of Nbt
which has a map from labels to element indices for fast lookup.
An NBT tag, responsible for storing the actual data.
Byte Int8 | 1-byte signed integer |
Short Int16 | 2-byte signed integer |
Int Int32 | 4-byte signed integer |
Long Int64 | 8-byte signed integer |
Float Float | 4-byte float |
Double Double | 8-byte double |
ByteArray (Vector Int8) | 4-byte signed integer length + N 1-byte signed integers |
String Text | 2-byte unsigned integer length + N bytes utf-8 text |
List (Vector (Tag b)) | 1-byte unsigned |
Compound (Cmpnd b) | N heterogenous NBT elements punctuated by an |
IntArray (Vector Int32) | 4-byte signed integer length + N 4-byte signed integers |
LongArray (Vector Int64) | 4-byte signed integer length + N 8-byte signed integers |
type MapTag = Tag (Map Text Int) Source #
A version of Tag
which has a map from labels to element indices for fast lookup.
The payload of the Compound
constructor.
type MapCmpnd = Cmpnd (Map Text Int) Source #
A version of Cmpnd
which has a map from labels to element indices for fast lookup.
writeUncompressed :: Serialize (Nbt b) => FilePath -> Nbt b -> IO () Source #
Write an uncompressed NBT file.