TV-Browser 2.7.5 API

webplugin.aclib.codec
Class AbstractDecoder

java.lang.Object
  extended by webplugin.aclib.codec.AbstractDecoder
Direct Known Subclasses:
ImageInputStreamDecoder, StreamDecoder

public abstract class AbstractDecoder
extends Object

Byte stream decoder for 1, 2, and 4 byte values in big or little endian format.

Author:
© Christian Treber, ct@ctreber.com

Field Summary
protected  long _pos
           
static int BIG_ENDIAN
          Highest order byte comes first.
static int LITTLE_ENDIAN
          Lowest order byte comes first.
 
Constructor Summary
AbstractDecoder()
           
 
Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIG_ENDIAN

public static final int BIG_ENDIAN
Highest order byte comes first.

See Also:
Constant Field Values

LITTLE_ENDIAN

public static final int LITTLE_ENDIAN
Lowest order byte comes first.

See Also:
Constant Field Values

_pos

protected long _pos
Constructor Detail

AbstractDecoder

public AbstractDecoder()
Method Detail

readUInt1

public short readUInt1()
                throws IOException
Returns:
A one byte value (aka BYTE, unsigned char)
Throws:
IOException

readUInt2

public int readUInt2()
              throws IOException
Returns:
A two byte value (aka WORD, unsigned short)
Throws:
IOException

readUInt4

public long readUInt4()
               throws IOException
Returns:
A four byte value (aka DWORD, unsigned long).
Throws:
IOException

setEndianess

public void setEndianess(int pEndianess)
Parameters:
pEndianess - The byte order
See Also:
BIG_ENDIAN, LITTLE_ENDIAN

getPos

public long getPos()
Returns:
Current position in file

seek

public abstract void seek(long pPos)
                   throws IOException
Parameters:
pPos - Position to advance to. Nothing will happen if the position has already been passed.
Throws:
IOException

readBytes

public abstract byte[] readBytes(long pBytes,
                                 byte[] pBuffer)
                          throws IOException
Implemented by a specific decoder.

Parameters:
pBytes - Bytes to read
pBuffer - The buffer to write the read bytes to. If null, a buffer is reserved.
Returns:
Array with the bytes read.
Throws:
IOException

readValue

protected long readValue(int pBytes)
                  throws IOException
Throws:
IOException

close

public abstract void close()
                    throws IOException
Call when done with decoder.

Throws:
IOException

TV-Browser 2.7.5 API

TV-Browser 2.7.5, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)