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
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 -
Method Summary
Modifier and TypeMethodDescriptionlongextractBits(int n) Extract the next n bits from the encoded message.protected abstract intFetch the next byte from the message.voidstart()Start message extraction.
-
Constructor Details
-
AbstractEncodedMessage
protected AbstractEncodedMessage()Empty constructor.This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.
- Since:
- 12.0
-
-
Method Details
-
start
public void start()Start message extraction.- Specified by:
startin 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:
extractBitsin interfaceEncodedMessage- Parameters:
n- number of bits to extract (cannot exceed 32 bits)- Returns:
- bits packed as the LSB of a 64 bits primitive long
-