public class DataChunkOutputStream
extends java.io.FilterOutputStream
| Modifier and Type | Field and Description |
|---|---|
protected long |
written
The number of bytes written to the data output stream so far.
|
| Constructor and Description |
|---|
DataChunkOutputStream(java.io.OutputStream out) |
DataChunkOutputStream(java.io.OutputStream out,
boolean forwardFlushAndClose) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCount()
Sets the value of the counter
written to 0. |
void |
close() |
void |
flush() |
protected void |
incCount(int value)
Increases the written counter by the specified value
until it reaches Long.MAX_VALUE.
|
long |
size()
Returns the current value of the counter
written,
the number of bytes written to this data output stream so far. |
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off to the underlying output stream. |
void |
write(int b)
Writes the specified byte (the low eight bits of the argument
b) to the underlying output stream. |
void |
writeByte(int v)
Writes out a
byte to the underlying output stream as
a 1-byte value. |
void |
writeInt(int v)
Writes an
int to the underlying output stream as four
bytes, high byte first. |
void |
writeInts24(int[] v,
int off,
int len)
Writes unsigned 24 bit integer values.
|
void |
writeLong(long v) |
void |
writeShort(int v)
Writes a signed 16 bit integer value.
|
void |
writeShorts(short[] v,
int off,
int len)
Writes a signed 16 bit integer value.
|
void |
writeType(java.lang.String s)
Writes an chunk type identifier (4 bytes).
|
void |
writeUInt(long v)
Writes an unsigned 32 bit integer value.
|
void |
writeUShort(int v) |
protected long written
public DataChunkOutputStream(java.io.OutputStream out)
public DataChunkOutputStream(java.io.OutputStream out,
boolean forwardFlushAndClose)
public void writeType(java.lang.String s)
throws java.io.IOException
s - A string with a length of 4 characters.java.io.IOExceptionpublic final void writeByte(int v)
throws java.io.IOException
byte to the underlying output stream as
a 1-byte value. If no exception is thrown, the counter
written is incremented by 1.v - a byte value to be written.java.io.IOException - if an I/O error occurs.FilterOutputStream.outpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
len bytes from the specified byte array
starting at offset off to the underlying output stream.
If no exception is thrown, the counter written is
incremented by len.write in class java.io.FilterOutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.java.io.IOException - if an I/O error occurs.FilterOutputStream.outpublic void write(int b)
throws java.io.IOException
b) to the underlying output stream. If no exception
is thrown, the counter written is incremented by
1.
Implements the write method of OutputStream.
write in class java.io.FilterOutputStreamb - the byte to be written.java.io.IOException - if an I/O error occurs.FilterOutputStream.outpublic void writeInt(int v)
throws java.io.IOException
int to the underlying output stream as four
bytes, high byte first. If no exception is thrown, the counter
written is incremented by 4.v - an int to be written.java.io.IOException - if an I/O error occurs.FilterOutputStream.outpublic void writeUInt(long v)
throws java.io.IOException
v - The valuejava.io.IOExceptionpublic void writeShort(int v)
throws java.io.IOException
v - The valuejava.io.IOExceptionpublic void writeShorts(short[] v,
int off,
int len)
throws java.io.IOException
v - The valuejava.io.IOExceptionpublic void writeInts24(int[] v,
int off,
int len)
throws java.io.IOException
v - The valuejava.io.IOExceptionpublic void writeLong(long v)
throws java.io.IOException
java.io.IOExceptionpublic void writeUShort(int v)
throws java.io.IOException
java.io.IOExceptionprotected void incCount(int value)
public final long size()
written,
the number of bytes written to this data output stream so far.
If the counter overflows, it will be wrapped to Integer.MAX_VALUE.written field.DataOutputStream.writtenpublic void clearCount()
written to 0.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterOutputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.FilterOutputStreamjava.io.IOException