 | binary-0.2: Binary serialization using lazy ByteStrings | Contents | Index |
|
| Data.Binary.Get | | Portability | portable to Hugs and GHC. | | Stability | experimental | | Maintainer | Lennart Kolmodin <kolmodin@dtek.chalmers.se> |
|
|
|
|
|
| Description |
| The Get monad. A monad for efficiently building structures from
encoded lazy ByteStrings
|
|
| Synopsis |
|
|
|
|
| The Get type
|
|
| data Get a |
| The Get monad is just a State monad carrying around the input ByteString
| Instances | |
|
|
| runGet :: Get a -> ByteString -> a |
| Run the Get monad applies a get-based parser on the input ByteString
|
|
| Parsing
|
|
| skip :: Int -> Get () |
| Skip ahead n bytes. Fails if fewer than n bytes are available.
|
|
| uncheckedSkip :: Int -> Get () |
| Skip ahead n bytes.
|
|
| lookAhead :: Get a -> Get a |
| Run ga, but return withou consuming its input.
Fails if ga fails.
|
|
| lookAheadM :: Get (Maybe a) -> Get (Maybe a) |
| Like lookAhead, but consume the input if g returns 'Just _'.
Fails if gma fails.
|
|
| lookAheadE :: Get (Either a b) -> Get (Either a b) |
| Like lookAhead, but consume the input if g returns 'Right _'.
Fails if gea fails.
|
|
| uncheckedLookAhead :: Int -> Get ByteString |
| Get the next up to n bytes as a lazy ByteString, without consuming them.
|
|
| getBytes :: Int -> Get ByteString |
| Pull up to n bytes from the input.
|
|
| remaining :: Get Int64 |
| Get the number of remaining unparsed bytes.
Useful for checking whether all input has been consumed.
Note that this forces the rest of the input.
|
|
| isEmpty :: Get Bool |
| Test whether all input has been consumed,
i.e. there are no remaining unparsed bytes.
|
|
| Parsing particular types
|
|
| getWord8 :: Get Word8 |
| Read a Word8 from the monad state
|
|
| ByteStrings
|
|
| getByteString :: Int -> Get ByteString |
| An efficient get method for strict ByteStrings
|
|
| getLazyByteString :: Int -> Get ByteString |
| An efficient get method for lazy ByteStrings. Fails if fewer than
n bytes are left in the input.
|
|
| Big-endian reads
|
|
| getWord16be :: Get Word16 |
| Read a Word16 in big endian format
|
|
| getWord16le :: Get Word16 |
| Read a Word16 in little endian format
|
|
| getWord32be :: Get Word32 |
| Read a Word32 in big endian format
|
|
| Little-endian reads
|
|
| getWord32le :: Get Word32 |
| Read a Word32 in little endian format
|
|
| getWord64be :: Get Word64 |
| Read a Word64 in big endian format
|
|
| getWord64le :: Get Word64 |
| Read a Word64 in little endian format
|
|
| Produced by Haddock version 0.8 |