Package org.orekit.gnss.metric.parser
Class AbstractEncodedMessage
- java.lang.Object
-
- org.orekit.gnss.metric.parser.AbstractEncodedMessage
-
- All Implemented Interfaces:
EncodedMessage
- Direct Known Subclasses:
ByteArrayEncodedMessage
,HexadecimalSequenceEncodedMessage
,InputStreamEncodedMessage
,StreamMonitor
public abstract class AbstractEncodedMessage extends Object implements EncodedMessage
Encoded messages as a sequence of bytes.Note that only full bytes are supported. This means that for example the 300 bits message from GPS sub-frames must be completed with 4 zero bits to reach 304 bits = 38 bytes, even if only the first 300 bits will be decoded and the 4 extra bits in the last byte will be ignored.
- Since:
- 11.0
- Author:
- Luc Maisonobe
-
-
Constructor Summary
Constructors Constructor Description AbstractEncodedMessage()
Empty constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
extractBits(int n)
Extract the next n bits from the encoded message.protected abstract int
fetchByte()
Fetch the next byte from the message.void
start()
Start message extraction.
-
-
-
Method Detail
-
start
public void start()
Start message extraction.- Specified by:
start
in interfaceEncodedMessage
-
fetchByte
protected abstract int fetchByte()
Fetch the next byte from the message.- Returns:
- next byte from the message, as a primitive integer, or -1 if end of data has been reached
-
extractBits
public long extractBits(int n)
Extract the next n bits from the encoded message.- Specified by:
extractBits
in interfaceEncodedMessage
- Parameters:
n
- number of bits to extract (cannot exceed 32 bits)- Returns:
- bits packed as the LSB of a 64 bits primitive long
-
-