def linesToBytes(): """ Convert lines into bytes. @return: Create a new tube for adding CRLF delimiters to a sequence of lines (frames) to produce bytes (segments). """ return _FramesToSegments(LineOnlyReceiver(), "sendLine")
def bytesDelimitedBy(delimiter): """ Consumes a stream of bytes and produces frames delimited by the given delimiter. @param delimiter: an octet sequence that separates frames in the incoming stream of bytes. @type delimiter: L{bytes} @return: a tube that converts a stream of bytes into a sequence of frames. @rtype: L{ITube} """ receiver = LineOnlyReceiver() receiver.delimiter = delimiter return _SegmentsToFrames(receiver, "lineReceived")