| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Bytes.Chunks
Description
Chunks of bytes. This is useful as a target for a builder
or as a way to read a large amount of whose size is unknown
in advance. Structurally, this type is similar to
Data.ByteString.Lazy.ByteString. However, the type in this
module is strict in its spine. Additionally, none of the
Handle functions perform lazy I/O.
Synopsis
- data Chunks
- = ChunksCons !Bytes !Chunks
- | ChunksNil
- length :: Chunks -> Int
- concat :: Chunks -> Bytes
- concatU :: Chunks -> ByteArray
- reverse :: Chunks -> Chunks
- reverseOnto :: Chunks -> Chunks -> Chunks
- fromBytes :: Bytes -> Chunks
- fromByteArray :: ByteArray -> Chunks
- unsafeCopy :: MutableByteArray s -> Int -> Chunks -> ST s Int
- hGetContents :: Handle -> IO Chunks
Types
A cons-list of byte sequences.
Constructors
| ChunksCons !Bytes !Chunks | |
| ChunksNil |
Properties
Manipulate
reverseOnto :: Chunks -> Chunks -> Chunks Source #
Variant of reverse that allows the caller to provide
an initial list of chunks that the reversed chunks will
be pushed onto.
Create
fromByteArray :: ByteArray -> Chunks Source #
Variant of fromBytes where the single chunk is unsliced.
Copy to buffer
Arguments
| :: MutableByteArray s | Destination |
| -> Int | Destination offset |
| -> Chunks | Source |
| -> ST s Int | Returns the next index into the destination after the payload |
Copy the contents of the chunks into a mutable array. Precondition: The destination must have enough space to house the contents. This is not checked.