|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
com.tffenterprises.music.tag.id3v2.io.UnsynchronizedOutputStream
public class UnsynchronizedOutputStream
A filter-type output stream that will de-unsynchronize data on the fly. MPEG's audio algorithm detects a starting point by detecting that two bytes (represented by the variable theShort) such that the expression ((theShort & 0xffe0) == 0xffe0) is true. The unsynchronization scheme is a reversible modification of the data in such a way that the MPEG algorithm will not find a valid start marker in the body of an ID3v2 tag. To unsynchronize a given output stream, construct an UnsynchronizedOutputStream using the output stream you want to unsynchronize as its argument. To de-unsynchronize a given input stream, construct an UnsynchronizedInputStream using the input stream you want to de-unsynchronize as its argument.
Field Summary | |
---|---|
private boolean |
hasUnsynchronized
A boolean that represents whether or not a single null byte has been written to the output stream as an unsynchronizing action. |
private boolean |
lastByteFull
A boolean that represents whether or not the latest byte written to the output stream was equal to 0xff. |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
UnsynchronizedOutputStream(java.io.OutputStream out)
The constructor takes as a parameter the OutputStream instance to which the Unsynchronized bytes shall be written. |
Method Summary | |
---|---|
void |
flush()
Flushes this output stream and forces any buffered output to be written out to the stream. |
boolean |
hasUnsynchronized()
Returns whether or not a single null byte has been written to the output stream as an unsynchronizing action. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes to the output stream, starting to read them from offset off in the given byte array. |
void |
write(int b)
Writes the specified byte to this output stream, unsynchronizing the output as necessary. |
Methods inherited from class java.io.FilterOutputStream |
---|
close, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean lastByteFull
private boolean hasUnsynchronized
Constructor Detail |
---|
public UnsynchronizedOutputStream(java.io.OutputStream out)
out
- the OutputStream instance to which the unsynchronized
bytes shall be written.Method Detail |
---|
public void write(int b) throws java.io.IOException
write
in class java.io.FilterOutputStream
b
- the byte to be written out.
java.io.IOException
- if an I/O error occurs.public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.FilterOutputStream
b
- the data.off
- the start offset in the data.len
- the number of bytes to write out of the data.
java.io.IOException
- if an I/O error occurs.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.FilterOutputStream
java.io.IOException
- if an I/O error occurs.public boolean hasUnsynchronized()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |