|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
hu.netmind.ogg.OggOutputStream
public class OggOutputStream
This class is the starting point for creating an ogg bitstream.
This class handles all features of the Ogg bitstream (as of RFC3533),
including multiplexing (grouping, chaining).
Grouping:Grouping is a form of multiplexing several logical
streams (eg. 1 audio, 1 video) into one stream. The Ogg format itself
does not specify exactly how data from these streams should be written
(in which order), so this class simply writes data out, when it arrives
on the logical input streams. To obtain several logical input streams
(eg. 1 for the video stream, 1 for the audio stream), call
createLogicalOutputStream which will return a stream to write.
Chaning:Chaning several logic streams means to concatenate two
ogg streams together. The Ogg specification says, that you must create all
logical output streams, before any data is to be written to any of the
created logical streams (except the header data, which is the first
written packet.) (In short: you must call the createLogicalOutputStream()
prior to any subsequent writePacket()). But, if you eventually close all
logical streams (these don't have to occur in any specific order), then
you may call createLogicalOutputStream() again (any number
of times), if you whish to "chain" new logical streams to this one.
The output of this stream may not be written on each call to write()
on the logical streams, because of internal buffering/paging, but all
data is guaranteed to be written on close().
This class is thread-safe, meaning that the separate logical streams may
be written to concurrently, and this class may be used by more than one
thread (to create logical streams, and to get information).
| Constructor Summary | |
|---|---|
OggOutputStream(java.io.OutputStream output)
The ogg bitstream will be written in the given output stream. |
|
| Method Summary | |
|---|---|
void |
close()
Close this Ogg stream, write any data that is pending into the stream, then releas all resources. |
LogicalOutputStream |
createLogicalOutputStream()
Create a logical bitstream to be written to this Ogg stream. A logical stream is a stream associated with the output of a single codec/source (eg. |
void |
flush()
Proxy call to output. |
boolean |
isClean()
Return, whether the call to createLogicalOutputStream()
will success. |
void |
waitForClose()
Wait for all logical streams to finish. |
void |
write(byte[] b)
Proxy call to output, this method should not be called, as it writes directly into the ogg stream. |
void |
write(byte[] b,
int offset,
int length)
Proxy call to output, this method should not be called, as it writes directly into the ogg stream. |
void |
write(int b)
Proxy call to output, this method should not be called, as it writes directly into the ogg stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OggOutputStream(java.io.OutputStream output)
output - The output stream the ogg is to be written to.| Method Detail |
|---|
public boolean isClean()
createLogicalOutputStream()
will success. Note, however, that in a multi-threaded environment
this call may return true, but directly after it the real call
may fail regardless (a concurrent thread may have already written
data by then).
createLogicalOutputStream()
will succseed or not. That is, is there an open logical stream, how
already sent data too.
public LogicalOutputStream createLogicalOutputStream()
throws InvalidStateException
InvalidStateException - If there is already data written to
the Ogg stream, and there is at least one logical stream still open.
public void close()
throws java.io.IOException
close() result in undefined results.
close in interface java.io.Closeableclose in class java.io.OutputStreamjava.io.IOException - If the output could not be written.public void waitForClose()
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException
public void write(byte[] b,
int offset,
int length)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOException
public void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOException
public void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||