|
Terrenus HRPT v2.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectterrenus.telemetry.AbstractTelemetryStream
public abstract class AbstractTelemetryStream
The AbstractTelemetryStream
class is a stream that
obtains data from a buffer. The buffer may have extra data at the
start and before each frame, and may be in little or big endian
byte order for multibyte data streams.
Field Summary | |
---|---|
protected java.nio.ByteBuffer |
input
The buffer used for data input. |
Constructor Summary | |
---|---|
AbstractTelemetryStream()
|
Method Summary | |
---|---|
protected abstract boolean |
checkFrame(int frame)
Checks a frame for errors. |
protected boolean |
checkStream()
Checks the telemetry stream for errors. |
java.nio.ByteBuffer |
getBlock(int frame,
int block)
Gets the data for the specified block. |
protected abstract int |
getBlockLength(int block)
Gets the length of a block. |
protected abstract int |
getBlockPosition(int block)
Gets the position of a block within a frame. |
int |
getDayCount()
Gets the starting day count, or -1 if not available. |
int |
getFrameCount()
Gets the total number of telemetry frames. |
protected int |
getFramePosition(int frame)
Gets the position of a frame within the input. |
static java.nio.ByteBuffer |
getInputBuffer(java.lang.String fileName)
Gets a mapped byte input buffer for the specified data file. |
int |
getYear()
Gets the starting year, or -1 if not available. |
protected void |
initStream(java.nio.ByteBuffer input,
int headerLength,
int frameLength,
int frameHeaderLength,
boolean isLittleEndian)
Initializes a new stream using the specified buffer as input. |
static void |
main(java.lang.String[] argv)
Tests this class. |
void |
setDayCount(int dayCount)
Sets the starting day count. |
void |
setYear(int year)
Sets the starting year. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface terrenus.telemetry.TelemetryStream |
---|
getBlockCount, getDecoder, getFormat |
Field Detail |
---|
protected java.nio.ByteBuffer input
Constructor Detail |
---|
public AbstractTelemetryStream()
Method Detail |
---|
public static java.nio.ByteBuffer getInputBuffer(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the file.
java.io.IOException
- if an error occurred accessing the file.protected void initStream(java.nio.ByteBuffer input, int headerLength, int frameLength, int frameHeaderLength, boolean isLittleEndian)
input
- the input buffer to read.headerLength
- the input header length in bytes.frameLength
- the frame length in bytes (including header).frameHeaderLength
- the frame header length.isLittleEndian
- the little endian flag, true for LSB first or
false for MSB first.protected int getFramePosition(int frame)
frame
- the frame in question.
protected abstract int getBlockPosition(int block)
block
- the block in question.
protected abstract int getBlockLength(int block)
block
- the block in question.
public java.nio.ByteBuffer getBlock(int frame, int block)
TelemetryStream
getBlock
in interface TelemetryStream
frame
- the frame to get data.block
- the block number to get data.
public int getYear() throws java.io.IOException
TelemetryStream
getYear
in interface TelemetryStream
java.io.IOException
public void setYear(int year)
TelemetryStream
setYear
in interface TelemetryStream
year
- the starting year. The year is returned by the next
call to TelemetryStream.getYear()
.public int getDayCount() throws java.io.IOException
TelemetryStream
getDayCount
in interface TelemetryStream
java.io.IOException
public void setDayCount(int dayCount)
TelemetryStream
setDayCount
in interface TelemetryStream
dayCount
- the starting day count. The day count is returned by the
next call to TelemetryStream.getDayCount()
.protected abstract boolean checkFrame(int frame)
frame
- the frame number to check.
checkStream()
protected boolean checkStream()
checkFrame(int)
for a contiguous sequence of frames at
the start of the stream to determine if the stream has valid
frame data. Child classes may want to override this method
to perform more elaborate stream checking.
public int getFrameCount()
TelemetryStream
getFrameCount
in interface TelemetryStream
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
|
Terrenus HRPT v2.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |