Hoogle Search
Within LTS Haskell 24.63 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
putShortByteString :: Putter ShortByteStringcereal Data.Serialize.Put No documentation available.
-
Fast base64 encoding and decoding for ByteStrings This package provides support for encoding and decoding binary data according to base64 (see also RFC 4648) for strict and lazy ByteStrings For a fuller-featured and better-performing Base64 library, see the base64 package.
toByteString :: Builder -> ByteStringblaze-builder Blaze.ByteString.Builder Run the builder to construct a strict bytestring containing the sequence of bytes denoted by the builder. This is done by first serializing to a lazy bytestring and then packing its chunks to a appropriately sized strict bytestring.
toByteString = packChunks . toLazyByteString
Note that toByteString is a Monoid homomorphism.toByteString mempty == mempty toByteString (x `mappend` y) == toByteString x `mappend` toByteString y
However, in the second equation, the left-hand-side is generally faster to execute.toByteStringIO :: (ByteString -> IO ()) -> Builder -> IO ()blaze-builder Blaze.ByteString.Builder toByteStringIOWith bufSize io b runs the builder b with a buffer of at least the size bufSize and executes the IO action io whenever the buffer is full. Compared to toLazyByteStringWith this function requires less allocation, as the output buffer is only allocated once at the start of the serialization and whenever something bigger than the current buffer size has to be copied into the buffer, which should happen very seldomly for the default buffer size of 32kb. Hence, the pressure on the garbage collector is reduced, which can be an advantage when building long sequences of bytes.
toByteStringIOWith :: Int -> (ByteString -> IO ()) -> Builder -> IO ()blaze-builder Blaze.ByteString.Builder No documentation available.
toLazyByteString :: Builder -> LazyByteStringblaze-builder Blaze.ByteString.Builder Execute a Builder and return the generated chunks as a LazyByteString. The work is performed lazy, i.e., only when a chunk of the LazyByteString is forced.
toLazyByteStringWith :: Int -> Int -> Int -> Builder -> ByteString -> ByteStringblaze-builder Blaze.ByteString.Builder Run a Builder with the given buffer sizes. Use this function for integrating the Builder type with other libraries that generate lazy bytestrings. Note that the builders should guarantee that on average the desired chunk size is attained. Builders may decide to start a new buffer and not completely fill the existing buffer, if this is faster. However, they should not spill too much of the buffer, if they cannot compensate for it. FIXME: Note that the following paragraphs are not entirely correct as of blaze-builder-0.4: A call toLazyByteStringWith bufSize minBufSize firstBufSize will generate a lazy bytestring according to the following strategy. First, we allocate a buffer of size firstBufSize and start filling it. If it overflows, we allocate a buffer of size minBufSize and copy the first buffer to it in order to avoid generating a too small chunk. Finally, every next buffer will be of size bufSize. This, slow startup strategy is required to achieve good speed for short (<200 bytes) resulting bytestrings, as for them the allocation cost is of a large buffer cannot be compensated. Moreover, this strategy also allows us to avoid spilling too much memory for short resulting bytestrings. Note that setting firstBufSize >= minBufSize implies that the first buffer is no longer copied but allocated and filled directly. Hence, setting firstBufSize = bufSize means that all chunks will use an underlying buffer of size bufSize. This is recommended, if you know that you always output more than minBufSize bytes.
writeToByteString :: Write -> ByteStringblaze-builder Blaze.ByteString.Builder Run a Write to produce a strict ByteString. This is equivalent to (toByteString . fromWrite), but is more efficient because it uses just one appropriately-sized buffer.
copyByteString :: ByteString -> Builderblaze-builder Blaze.ByteString.Builder.ByteString Construct a Builder that copies the strict ByteString. Use this function to create Builders from smallish (<= 4kb) ByteStrings or if you need to guarantee that the ByteString is not shared with the chunks generated by the Builder.
copyLazyByteString :: ByteString -> Builderblaze-builder Blaze.ByteString.Builder.ByteString Construct a Builder that copies the lazy ByteString.