public abstract class AbstractDecoder extends Object
Byte stream decoder for 1, 2, and 4 byte values in big or little endian format.
Modifier and Type | Field and Description |
---|---|
protected long |
_pos |
static int |
BIG_ENDIAN
Highest order byte comes first.
|
static int |
LITTLE_ENDIAN
Lowest order byte comes first.
|
Constructor and Description |
---|
AbstractDecoder() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Call when done with decoder.
|
long |
getPos() |
abstract byte[] |
readBytes(long pBytes,
byte[] pBuffer)
Implemented by a specific decoder.
|
short |
readUInt1() |
int |
readUInt2() |
long |
readUInt4() |
protected long |
readValue(int pBytes) |
abstract void |
seek(long pPos) |
void |
setEndianess(int pEndianess) |
public static final int BIG_ENDIAN
public static final int LITTLE_ENDIAN
protected long _pos
public short readUInt1() throws IOException
IOException
public int readUInt2() throws IOException
IOException
public long readUInt4() throws IOException
IOException
public void setEndianess(int pEndianess)
pEndianess
- The byte orderBIG_ENDIAN
,
LITTLE_ENDIAN
public long getPos()
public abstract void seek(long pPos) throws IOException
pPos
- Position to advance to. Nothing will happen if the position
has already been passed.IOException
public abstract byte[] readBytes(long pBytes, byte[] pBuffer) throws IOException
pBytes
- Bytes to readpBuffer
- The buffer to write the read bytes to. If null, a buffer is
reserved.IOException
protected long readValue(int pBytes) throws IOException
IOException
public abstract void close() throws IOException
IOException
TV-Browser 2.7.6, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)