|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.coder.SWFDecoder
public final class SWFDecoder
SWFDecoder wraps an InputStream with a buffer to reduce the amount of memory required to decode a movie and to improve efficiency by reading data from a file or external source in blocks.
Field Summary | |
---|---|
static int |
BUFFER_SIZE
The default size, in bytes, for the internal buffer. |
Constructor Summary | |
---|---|
SWFDecoder(InputStream streamIn)
Create a new SWFDecoder for the underlying InputStream using the default buffer size. |
|
SWFDecoder(InputStream streamIn,
int length)
Create a new SWFDecoder for the underlying InputStream with the specified buffer size. |
Method Summary | |
---|---|
void |
alignToByte()
Changes the location to the next byte boundary. |
int |
bytesRead()
Get the number of bytes read from the last saved position. |
void |
check(int count)
Compare the number of bytes read since the last saved position and record any difference. |
void |
fill()
Fill the internal buffer. |
int |
getDelta()
Get the difference from the expected number of bytes from the last call to check(). |
int |
getExpected()
Get the expected number of bytes from the last call to check(). |
int |
getLocation()
Get the location recorded for the last call to check(). |
int |
mark()
Remember the current position. |
int |
readBits(int numberOfBits,
boolean signed)
Read a bit field. |
int |
readByte()
Read an unsigned byte. |
byte[] |
readBytes(byte[] bytes)
Reads an array of bytes. |
float |
readHalf()
Read a single-precision floating point number. |
int |
readInt()
Read an unsigned 32-bit integer. |
int |
readSignedShort()
Read an unsigned 16-bit integer. |
String |
readString()
Read a null-terminated string using the default character set defined in the decoder. |
String |
readString(int length)
Read a string using the default character set defined in the decoder. |
int |
readUnsignedShort()
Read an unsigned 16-bit integer. |
int |
readVarInt()
Read a 32-bit unsigned integer, encoded using a variable number of bytes. |
void |
reset()
Reposition the decoder to the point recorded by the last call to the mark() method. |
int |
scanBits(int numberOfBits,
boolean signed)
Read-ahead a bit field. |
int |
scanByte()
Read an unsigned byte but do not advance the internal pointer. |
int |
scanUnsignedShort()
Read an unsigned 16-bit integer. |
void |
setEncoding(CharacterEncoding enc)
Sets the character encoding scheme used when encoding or decoding strings. |
void |
skip(int count)
Skips over and discards n bytes of data. |
void |
unmark()
Discard the last saved position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUFFER_SIZE
Constructor Detail |
---|
public SWFDecoder(InputStream streamIn, int length)
streamIn
- the stream from which data will be read.length
- the size in bytes of the buffer.public SWFDecoder(InputStream streamIn)
streamIn
- the stream from which data will be read.Method Detail |
---|
public void fill() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public int mark()
public void unmark()
public void reset() throws IOException
IOException
- if the internal buffer was filled after mark() was
called.public void check(int count)
count
- the expected number of bytes read.public int getLocation()
public int getExpected()
public int getDelta()
public int bytesRead()
public void alignToByte()
public void skip(int count) throws IOException
count
- the number of bytes to skip.
IOException
- if an error occurs reading from the underlying
input stream.public int readBits(int numberOfBits, boolean signed) throws IOException
numberOfBits
- the number of bits to read.signed
- indicates whether the integer value read is signed.
IOException
- if an error occurs reading from the underlying
input stream.public int scanBits(int numberOfBits, boolean signed) throws IOException
numberOfBits
- the number of bits to read.signed
- indicates whether the integer value read is signed.
IOException
- if an error occurs reading from the underlying
input stream.public int scanByte() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public int readByte() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public byte[] readBytes(byte[] bytes) throws IOException
bytes
- the array that will contain the bytes read.
IOException
- if an error occurs reading from the underlying
input stream.public void setEncoding(CharacterEncoding enc)
enc
- the CharacterEncoding that identifies how strings are encoded.public String readString(int length) throws IOException
length
- the number of bytes to read.
IOException
- if an error occurs reading from the underlying
input stream.public String readString() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public int scanUnsignedShort() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public int readUnsignedShort() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public int readSignedShort() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public int readInt() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public int readVarInt() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.public float readHalf() throws IOException
IOException
- if an error occurs reading from the underlying
input stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |