org.red5.io.mp4

## Class MP4DataStream

- java.lang.Object
- - org.red5.io.mp4.MP4DataStream

    public final class MP4DataStream
    extends Object

Wrapper class for input streams containing MPEG4 data. Original idea based on code from MediaFrame (http://www.mediaframe.org) 11/2011 - Converted to use NIO

Author:
  Paul Gregoire (mondain@gmail.com)

### Constructor Summary

Constructors
Constructor and Description
`MP4DataStream(FileInputStream is)` Constructs an `MP4DataStream` object using the specified MPEG4 input stream.

### Method Summary

Methods
`void` `close()`
`FileChannel` `getChannel()`
`long` `getOffset()`
`long` `readBytes(int n)` Reads "n" bytes from the channel.
`String` `readString(int n)` Returns a string of "n" bytes in length from the channel.
`void` `skipBytes(long n)` Skip ahead in the channel by "n" bytes.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MP4DataStream

    public MP4DataStream(FileInputStream is)

Constructs an `MP4DataStream` object using the specified MPEG4 input stream.

Parameters:
  `is` - the MPEG4 input stream.

### Method Detail

#### readBytes

    public long readBytes(int n)
                   throws IOException

Reads "n" bytes from the channel.

Parameters:
  `n` -
Returns:
  long value from the channel
Throws:
  `IOException`

#### readString

    public String readString(int n)
                      throws IOException

Returns a string of "n" bytes in length from the channel.

Parameters:
  `n` -
Returns:
  string from the channel
Throws:
  `IOException`

#### skipBytes

    public void skipBytes(long n)
                   throws IOException

Skip ahead in the channel by "n" bytes.

Parameters:
  `n` -
Throws:
  `IOException`

#### getOffset

    public long getOffset()

#### getChannel

    public FileChannel getChannel()

#### close

    public void close()
               throws IOException

Throws:
  `IOException`