Package org.xj3d.io
Class StreamContentContainer
java.lang.Object
org.xj3d.io.StreamContentContainer
This is a utility class used by content handlers to return an input stream
to nodes that require streamed input.
Content handlers return objects that are reused by nodes in the scene. This object type can be used to pass an InputStream to the nodes. Each client will request a new input stream using getInputStream.
- Version:
- $Revision: 1.1 $
- Author:
- Guy Carpenter
-
Constructor Summary
ConstructorsConstructorDescriptionStreamContentContainer
(InputStream inputStream, int length, int format, int frequency) Construct a new content container from an input stream. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns a direct reference to the underlying buffer.int
Get the format.int
Get the frequency of the content.Returns an input stream associated with this resource.
-
Constructor Details
-
StreamContentContainer
public StreamContentContainer(InputStream inputStream, int length, int format, int frequency) throws IOException Construct a new content container from an input stream. The content container is a copy of the entire byte stream. Calls to getInputStream will return new InputStreams which are byte-copies of the original input stream.If length bytes cannot be read from the input stream, an IOException will be thrown.
- Parameters:
inputStream
- input stream to read data fromlength
- number of bytes of data to read from the input streamformat
- The format, defined in ALConstantsfrequency
- The frequency- Throws:
IOException
- either too few bytes were read or read failed
-
-
Method Details
-
getInputStream
Returns an input stream associated with this resource. If the resource is cachable (canCache returns true) this method may be called more than once, and each call will return a new stream.- Returns:
- Returns a new InputStream which will return same byte-stream as original InputStream.
-
getBuffer
public byte[] getBuffer()Returns a direct reference to the underlying buffer.- Returns:
- The underlying buffer.
-
getFormat
public int getFormat()Get the format. Defined in OpenAL.ALConstants.- Returns:
- The format of the audio data
-
getFrequency
public int getFrequency()Get the frequency of the content.- Returns:
- The frequency.
-