|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.coder.SWFEncoder
public final class SWFEncoder
SWFEncoder wraps an OutputStream with a buffer to reduce the amount of memory required to encode a movie and to improve efficiency by writing data to a file or external source in blocks.
| Field Summary | |
|---|---|
static int |
BUFFER_SIZE
The default size, in bytes, for the internal buffer. |
| Constructor Summary | |
|---|---|
SWFEncoder(OutputStream streamOut)
Create a new SWFEncoder for the underlying InputStream using the default buffer size. |
|
SWFEncoder(OutputStream streamOut,
int length)
Create a new SWFEncoder for the underlying InputStream with the specified buffer size. |
|
| Method Summary | |
|---|---|
void |
alignToByte()
Changes the location to the next byte boundary. |
void |
check(int expected)
Compare the number of bytes read with the expected number and throw an exception if there is a difference. |
void |
flush()
Write the data currently stored in the buffer to the underlying stream. |
int |
mark()
Remember the current position. |
void |
setEncoding(CharacterEncoding enc)
Sets the character encoding scheme used when encoding or decoding strings. |
void |
unmark()
Discard the last saved position. |
void |
writeBits(int value,
int numberOfBits)
Write a value to bit field. |
void |
writeByte(int value)
Write a byte. |
int |
writeBytes(byte[] bytes)
Write an array of bytes. |
void |
writeHalf(float value)
Write a single-precision floating point number. |
void |
writeInt(int value)
Write a 32-bit integer. |
void |
writeShort(int value)
Write a 16-bit integer. |
void |
writeString(String str)
Write a string using the default character set defined in the encoder. |
void |
writeVarInt(int value)
Write a 32-bit unsigned integer, encoded in a variable number of bytes. |
| 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 SWFEncoder(OutputStream streamOut,
int length)
streamOut - the stream from which data will be written.length - the size in bytes of the buffer.public SWFEncoder(OutputStream streamOut)
streamOut - the stream from which data will be written.| Method Detail |
|---|
public void setEncoding(CharacterEncoding enc)
enc - the CharacterEncoding that identifies how strings are encoded.public int mark()
public void unmark()
public void check(int expected)
throws CoderException
expected - the expected number of bytes read.
CoderException - if the number of bytes read is different from the
expected number.public void alignToByte()
public void flush()
throws IOException
IOException - if an error occurs while writing the data to the
stream.
public void writeBits(int value,
int numberOfBits)
throws IOException
value - the value.numberOfBits - the (least significant) number of bits that will be written.
IOException - if there is an error writing data to the underlying
stream.
public void writeByte(int value)
throws IOException
value - the value to be written - only the least significant byte will
be written.
IOException - if there is an error writing data to the underlying
stream.
public int writeBytes(byte[] bytes)
throws IOException
bytes - the array to be written.
IOException - if there is an error reading data from the underlying
stream.
public void writeString(String str)
throws IOException
str - the string.
IOException - if there is an error reading data from the underlying
stream.
public void writeShort(int value)
throws IOException
value - an integer containing the value to be written.
IOException - if there is an error reading data from the underlying
stream.
public void writeInt(int value)
throws IOException
value - an integer containing the value to be written.
IOException - if there is an error reading data from the underlying
stream.
public void writeVarInt(int value)
throws IOException
value - an integer containing the value to be written.
IOException - if there is an error reading data from the underlying
stream.
public void writeHalf(float value)
throws IOException
value - the value to be written.
IOException - if there is an error reading data from the underlying
stream.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||