java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.monte.media.avi.DataChunkOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
This output stream filter supports common data types used inside
of an AVI RIFF Data Chunk.
- Author:
- Werner Randelshofer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longThe number of bytes written to the data output stream so far.Fields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSets the value of the counterwrittento 0.voidclose()voidflush()protected voidincCount(int value) Increases the written counter by the specified value until it reaches Long.MAX_VALUE.final longsize()Returns the current value of the counterwritten, the number of bytes written to this data output stream so far.voidwrite(byte[] b, int off, int len) Writeslenbytes from the specified byte array starting at offsetoffto the underlying output stream.voidwrite(int b) Writes the specified byte (the low eight bits of the argumentb) to the underlying output stream.final voidwriteByte(int v) Writes out abyteto the underlying output stream as a 1-byte value.voidwriteInt(int v) Writes anintto the underlying output stream as four bytes, low byte first.voidwriteInts24(int[] v, int off, int len) Writes unsigned 24 bit integer values.voidwriteLong(long v) voidwriteShort(int v) Writes a signed 16 bit integer value.voidwriteShorts(short[] v, int off, int len) Writes a signed 16 bit integer value.voidWrites an chunk type identifier (4 bytes).voidwriteUInt(long v) Writes an unsigned 32 bit integer value.voidwriteUShort(int v) Methods inherited from class java.io.FilterOutputStream
writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
written
protected long writtenThe number of bytes written to the data output stream so far. If this counter overflows, it will be wrapped to Integer.MAX_VALUE.
-
-
Constructor Details
-
DataChunkOutputStream
-
DataChunkOutputStream
-
-
Method Details
-
writeType
Writes an chunk type identifier (4 bytes).- Parameters:
s- A string with a length of 4 characters.- Throws:
IOException
-
writeByte
Writes out abyteto the underlying output stream as a 1-byte value. If no exception is thrown, the counterwrittenis incremented by1.- Parameters:
v- abytevalue to be written.- Throws:
IOException- if an I/O error occurs.- See Also:
-
write
Writeslenbytes from the specified byte array starting at offsetoffto the underlying output stream. If no exception is thrown, the counterwrittenis incremented bylen.- Overrides:
writein classFilterOutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
IOException- if an I/O error occurs.- See Also:
-
write
Writes the specified byte (the low eight bits of the argumentb) to the underlying output stream. If no exception is thrown, the counterwrittenis incremented by1.Implements the
writemethod ofOutputStream.- Overrides:
writein classFilterOutputStream- Parameters:
b- thebyteto be written.- Throws:
IOException- if an I/O error occurs.- See Also:
-
writeInt
Writes anintto the underlying output stream as four bytes, low byte first. If no exception is thrown, the counterwrittenis incremented by4.- Parameters:
v- anintto be written.- Throws:
IOException- if an I/O error occurs.- See Also:
-
writeUInt
Writes an unsigned 32 bit integer value.- Parameters:
v- The value- Throws:
IOException
-
writeShort
Writes a signed 16 bit integer value.- Parameters:
v- The value- Throws:
IOException
-
writeShorts
Writes a signed 16 bit integer value.- Parameters:
v- The value- Throws:
IOException
-
writeInts24
Writes unsigned 24 bit integer values.- Parameters:
v- The value- Throws:
IOException
-
writeLong
- Throws:
IOException
-
writeUShort
- Throws:
IOException
-
incCount
protected void incCount(int value) Increases the written counter by the specified value until it reaches Long.MAX_VALUE. -
size
public final long size()Returns the current value of the counterwritten, the number of bytes written to this data output stream so far. If the counter overflows, it will be wrapped to Integer.MAX_VALUE.- Returns:
- the value of the
writtenfield.
-
clearCount
public void clearCount()Sets the value of the counterwrittento 0. -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException
-