public interface ByteInflow
Unified in-flow of bytes with getters for standard primitives.
/!\ All array or String lengths are encoded as UInt32 to reflect their maximum possible length in JAVA.
- Author:
- Pierre Convert Copyright (C) 2022, Pierre Convert. All rights reserved.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Standard encoding for FALSE boolean value/static final int
Standard encoding for TRUE boolean value/ -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
getBool8()
getBool8byte
getByte()
getBytebyte[]
getByteArray
(int length) length passed as argumentlong
getCount()
getCountboolean[]
getFlags8float
getFloat32double
getFloat64default double[]
getFloat64Arrayshort
getInt16()
getInt16int
getInt32()
getInt32default int[]
getInt32Arraylong
getInt64()
getInt64byte
getInt8()
getInt8getStringUTF8 ASCII char only String, whose length is encoded on 8bits (max length is 256).int
getUInt16int
getUInt24int
getUInt31int
getUInt32 Curretly doing the same asgetUInt31
long
getUInt40long
getUInt48long
getUInt56long
getUInt64long
getUInt7xint
getUInt8()
getUInt8boolean
matches
(byte[] sequence) Tells if the next bytes in the ByteInput are matching the sequence passed as argument.void
startRecording
(ByteOutflow outflow) startRecordingvoid
stopRecording
-
Field Details
-
BOOL8_FALSE
static final int BOOL8_FALSEStandard encoding for FALSE boolean value/- See Also:
-
BOOL8_TRUE
static final int BOOL8_TRUEStandard encoding for TRUE boolean value/- See Also:
-
-
Method Details
-
getCount
long getCount()getCount- Returns:
- the count
-
getByte
getByte- Returns:
- next byte
- Throws:
IOException
- exception while reading from the flow
-
getBool8
getBool8- Returns:
- next byte
- Throws:
IOException
- exception while reading from the flow
-
getByteArray
length passed as argument- Parameters:
length
- next bytes, where n is the length of thebytes
array- Returns:
- the byte array read from the flow
- Throws:
IOException
- exception while reading from the flow
-
matches
Tells if the next bytes in the ByteInput are matching the sequence passed as argument. Note that this method will return an exception if there is not enough bytes to make the comparison.- Parameters:
sequence
- the bytes sequence to be tested against the inflow- Returns:
- true if sequence is matching underlying bytes.
- Throws:
IOException
- exception while reading from the flow
-
getFlags8
getFlags8- Returns:
- the flags
- Throws:
IOException
- exception while reading from the flow
-
getUInt7x
getUInt7x- Returns:
- the long value read from the flow
- Throws:
IOException
- exception while reading from the flow
-
getUInt8
getUInt8- Returns:
- the next Unsigned Integer 8 bits (1 byte)
- Throws:
IOException
- exception while reading from the flow
-
getUInt16
getUInt16- Returns:
- the next Unsigned Integer 16 bits (2 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getUInt24
getUInt24- Returns:
- the next Unsigned Integer 16 bits (2 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getUInt31
getUInt31- Returns:
- the next Unsigned Integer 31 bits (4 bytes, first bit ignored)
- Throws:
IOException
- exception while reading from the flow
-
getUInt32
getUInt32 Curretly doing the same asgetUInt31
- Returns:
- the int read forom flow
- Throws:
IOException
- exception while reading from the flow
-
getUInt40
getUInt40- Returns:
- the next Unsigned Integer 16 bits (2 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getUInt48
getUInt48- Returns:
- the next Unsigned Integer 16 bits (2 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getUInt56
getUInt56- Returns:
- the next Unsigned Integer 16 bits (2 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getUInt64
getUInt64- Returns:
- the next Unsigned Integer 16 bits (2 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getInt8
getInt8- Returns:
- the value
- Throws:
IOException
- exception while reading from the flow
-
getInt16
getInt16- Returns:
- the next Signed Integer 16 bits (2 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getInt32
getInt32- Returns:
- the next Signed Integer 32 bits (4 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getInt32Array
getInt32Array- Returns:
- the value
- Throws:
IOException
- exception while reading from the flow
-
getInt64
getInt64- Returns:
- the next Signed Integer 64 bits (8 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getFloat32
getFloat32- Returns:
- the next Float 32 bits (4 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getFloat64
getFloat64- Returns:
- the next Float 64 bits (8 bytes)
- Throws:
IOException
- exception while reading from the flow
-
getFloat64Array
getFloat64Array- Returns:
- the value
- Throws:
IOException
- exception while reading from the flow
-
getStringUTF8
getStringUTF8 ASCII char only String, whose length is encoded on 8bits (max length is 256).- Returns:
- the value
- Throws:
IOException
- exception while reading from the flow
-
startRecording
startRecording- Parameters:
outflow
- theouflow
-
stopRecording
stopRecording- Throws:
IOException
- exception while reading from the flow
-