Stability | beta |
---|---|
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
Enumerator tools for working with text-based network protocols.
- netLine :: forall m. Monad m => Int -> Iteratee ByteString m (Maybe ByteString)
- netLineEmpty :: Monad m => Int -> Iteratee ByteString m (Maybe ByteString)
- netWord :: Monad m => Int -> Iteratee ByteString m (Maybe ByteString)
- netWordEmpty :: Monad m => Int -> Iteratee ByteString m (Maybe ByteString)
- netLines :: Monad m => Int -> Enumeratee ByteString ByteString m b
- netLinesEmpty :: Monad m => Int -> Enumeratee ByteString ByteString m b
- netWords :: Monad m => Int -> Enumeratee ByteString ByteString m b
- netWordsEmpty :: Monad m => Int -> Enumeratee ByteString ByteString m b
- netSplitBy :: forall m. Monad m => (Word8 -> Bool) -> (Word8 -> Bool) -> Int -> Iteratee ByteString m (Maybe ByteString)
- netSplitsBy :: forall b m. Monad m => Iteratee ByteString m (Maybe ByteString) -> Enumeratee ByteString ByteString m b
- enumHandleTimeout :: forall b m. MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m b
Iteratees
netLine :: forall m. Monad m => Int -> Iteratee ByteString m (Maybe ByteString)Source
Get the next nonempty line from the stream using netLineEmpty
.
netLineEmpty :: Monad m => Int -> Iteratee ByteString m (Maybe ByteString)Source
Get the next line from the stream, length-limited by the given
Int
. This iteratee is error-tolerant by using LF as the line
terminator and simply ignoring all CR characters.
netWord :: Monad m => Int -> Iteratee ByteString m (Maybe ByteString)Source
Get the next nonempty word from the stream with the given maximum
length. Based on netWordEmpty
.
netWordEmpty :: Monad m => Int -> Iteratee ByteString m (Maybe ByteString)Source
Get the next word from the stream with the given maximum length. This iteratee is error-tolerant by using ASCII whitespace as splitting characters.
Enumeratees
netLines :: Monad m => Int -> Enumeratee ByteString ByteString m bSource
Convert a raw byte stream to a stream of lines based on netLine
.
netLinesEmpty :: Monad m => Int -> Enumeratee ByteString ByteString m bSource
Convert a raw byte stream to a stream of lines based on
netLineEmpty
.
netWords :: Monad m => Int -> Enumeratee ByteString ByteString m bSource
Split the raw byte stream into words based on netWord
.
netWordsEmpty :: Monad m => Int -> Enumeratee ByteString ByteString m bSource
Split the raw byte stream into words based on netWords
.
General stream splitters
netSplitBy :: forall m. Monad m => (Word8 -> Bool) -> (Word8 -> Bool) -> Int -> Iteratee ByteString m (Maybe ByteString)Source
Get the next token, where tokens are splitted by the first given
predicate and filtered by the second. Tokens are length-limited by
the given Int
and are truncated safely in constant space.
netSplitsBy :: forall b m. Monad m => Iteratee ByteString m (Maybe ByteString) -> Enumeratee ByteString ByteString m bSource
Split the stream using the supplied iteratee.
Enumerators
enumHandleTimeout :: forall b m. MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m bSource
Enumerate from a handle with the given buffer size (first argument)
and timeout in milliseconds (second argument). If the timeout is
exceeded an exception is thrown via throwError
.