Package 

Class PacketFlowKt

    • Method Detail

      • delimiter

         final static Flow<ByteArray> delimiter(Flow<ByteArray> $self, ByteArray delimiter, Integer maxBufferSize)

        Splits the flow of byte arrays into chunks based on a delimiter. Useful for handling "sticky packets" where messages are separated by a specific byte sequence.

        Parameters:
        delimiter - The byte sequence that separates packets
        maxBufferSize - Maximum buffer size before throwing BufferOverflowException (default 1MB)
      • delimiterBased

         final static Flow<ByteArray> delimiterBased(Flow<ByteArray> $self, ByteArray delimiter, Integer maxBufferSize)

        Splits the flow of byte arrays into chunks based on a delimiter. Alias for delimiter for backwards compatibility.

        Parameters:
        delimiter - The byte sequence that separates packets
        maxBufferSize - Maximum buffer size before throwing BufferOverflowException (default 1MB)
      • fixedLength

         final static Flow<ByteArray> fixedLength(Flow<ByteArray> $self, Integer length, Integer maxBufferSize)

        Splits the flow of byte arrays into fixed-length chunks.

        Parameters:
        length - The fixed length of each packet
        maxBufferSize - Maximum buffer size before throwing BufferOverflowException (default 1MB)
      • startEndMarker

         final static Flow<ByteArray> startEndMarker(Flow<ByteArray> $self, ByteArray startMarker, ByteArray endMarker, Boolean includeMarkers, Integer maxBufferSize)

        Splits the flow of byte arrays into packets based on start and end markers. Useful for protocols that frame packets with specific sequences (e.g., STX/ETX).

        Parameters:
        startMarker - The byte sequence that marks the start of a packet
        endMarker - The byte sequence that marks the end of a packet
        includeMarkers - If true, include start/end markers in emitted packets (default false)
        maxBufferSize - Maximum buffer size before throwing BufferOverflowException (default 1MB)
      • lengthPrefixed

         final static Flow<ByteArray> lengthPrefixed(Flow<ByteArray> $self, Integer lengthFieldOffset, Integer lengthFieldSize, Boolean lengthIncludesHeader, Integer headerSize, Boolean bigEndian, Integer maxBufferSize)

        Splits the flow of byte arrays into packets based on a length prefix. Common in binary protocols where the first N bytes indicate packet length.

        Parameters:
        lengthFieldOffset - Offset of the length field from the start of the packet (default 0)
        lengthFieldSize - Size of the length field in bytes (1, 2, or 4, default 2)
        lengthIncludesHeader - If true, length includes the header bytes (default false)
        headerSize - Total header size (default equals lengthFieldOffset + lengthFieldSize)
        bigEndian - If true, length is big-endian; if false, little-endian (default true)
        maxBufferSize - Maximum buffer size before throwing BufferOverflowException (default 1MB)
      • customParser

         final static Flow<ByteArray> customParser(Flow<ByteArray> $self, PacketParser parser, Integer maxBufferSize)

        Splits the flow of byte arrays using a custom PacketParser. Use this when built-in methods don't fit your protocol.

        Parameters:
        parser - Custom parser implementation
        maxBufferSize - Maximum buffer size before throwing BufferOverflowException (default 1MB)