Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media.avi
Class DataChunkOutputStream

    java.lang.Object
      java.io.OutputStream
          java.io.FilterOutputStream
              org.monte.media.avi.DataChunkOutputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable

    public class DataChunkOutputStream

extends java.io.FilterOutputStream

This output stream filter supports common data types used inside of an AVI RIFF Data Chunk.

Version:
  1.1 2011-01-17 Adds functionality for preventing "flush" and "close" of the underlying stream.
  1.0.1 2010-04-05 Removed unused constants.
  1.0 2008-08-11 Created.
Author:
  Werner Randelshofer

Field Summary
`protected long` | `written` The number of bytes written to the data output stream so far.

Fields inherited from class java.io.FilterOutputStream
`out`

Constructor Summary
`DataChunkOutputStream(java.io.OutputStream out)`
`DataChunkOutputStream(java.io.OutputStream out, boolean forwardFlushAndClose)`

Method Summary
`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)`

Methods inherited from class java.io.FilterOutputStream
`write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### written

    protected long written

  The number of bytes written to the data output stream so far. If this counter overflows, it will be wrapped to Integer.MAX_VALUE.

Constructor Detail

### DataChunkOutputStream

    public DataChunkOutputStream(java.io.OutputStream out)

### DataChunkOutputStream

    public DataChunkOutputStream(java.io.OutputStream out,
                                 boolean forwardFlushAndClose)

Method Detail

### writeType

    public void writeType(java.lang.String s)
                   throws java.io.IOException

  Writes an chunk type identifier (4 bytes).

  Parameters:
    `s` - A string with a length of 4 characters.
  Throws:
    `java.io.IOException`

### writeByte

    public final void writeByte(int v)
                         throws java.io.IOException

  Writes out a `byte` to the underlying output stream as a 1-byte value. If no exception is thrown, the counter `written` is incremented by `1`.

  Parameters:
    `v` - a `byte` value to be written.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `FilterOutputStream.out`

### write

    public void write(byte[] b,
                      int off,
                      int len)
               throws java.io.IOException

  Writes `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`.

  Overrides:
    `write` in class `java.io.FilterOutputStream`
  Parameters:
    `b` - the data.
    `off` - the start offset in the data.
    `len` - the number of bytes to write.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `FilterOutputStream.out`

### write

    public void write(int b)
               throws java.io.IOException

  Writes the specified byte (the low eight bits of the argument `b`) to the underlying output stream. If no exception is thrown, the counter `written` is incremented by `1`.

  Implements the `write` method of `OutputStream`.

  Overrides:
    `write` in class `java.io.FilterOutputStream`
  Parameters:
    `b` - the `byte` to be written.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `FilterOutputStream.out`

### writeInt

    public void writeInt(int v)
                  throws java.io.IOException

  Writes an `int` to the underlying output stream as four bytes, high byte first. If no exception is thrown, the counter `written` is incremented by `4`.

  Parameters:
    `v` - an `int` to be written.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
  See Also:
    `FilterOutputStream.out`

### writeUInt

    public void writeUInt(long v)
                   throws java.io.IOException

  Writes an unsigned 32 bit integer value.

  Parameters:
    `v` - The value
  Throws:
    `java.io.IOException`

### writeShort

    public void writeShort(int v)
                    throws java.io.IOException

  Writes a signed 16 bit integer value.

  Parameters:
    `v` - The value
  Throws:
    `java.io.IOException`

### writeShorts

    public void writeShorts(short[] v,
                            int off,
                            int len)
                     throws java.io.IOException

  Writes a signed 16 bit integer value.

  Parameters:
    `v` - The value
  Throws:
    `java.io.IOException`

### writeInts24

    public void writeInts24(int[] v,
                            int off,
                            int len)
                     throws java.io.IOException

  Writes unsigned 24 bit integer values.

  Parameters:
    `v` - The value
  Throws:
    `java.io.IOException`

### writeLong

    public void writeLong(long v)
                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### writeUShort

    public void writeUShort(int v)
                     throws java.io.IOException

  Throws:
    `java.io.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 counter `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.

  Returns:
    the value of the `written` field.
  See Also:
    `DataOutputStream.written`

### clearCount

    public void clearCount()

  Sets the value of the counter `written` to 0.

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException`

### flush

    public void flush()
               throws java.io.IOException

  Specified by:
    `flush` in interface `java.io.Flushable`
  Overrides:
    `flush` in class `java.io.FilterOutputStream`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD