コード例 #1
0
ファイル: framing.py プロジェクト: muthumal21/BDAMahout
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")
コード例 #2
0
ファイル: framing.py プロジェクト: muthumal21/BDAMahout
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")