|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
com.tffenterprises.music.tag.id3v2.io.UnsynchronizedInputStream
public class UnsynchronizedInputStream
A filter-type input stream that will de-unsynchronize data on the fly. The MPEG 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 |
skipIfNull
A boolean representing whether or not the last byte read from the the input stream was equal to 0xff. |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
UnsynchronizedInputStream(java.io.InputStream in)
The constructor takes as a parameter the InputStream instance from which the Unsynchronized bytes shall be read. |
Method Summary | |
---|---|
int |
read()
Reads a byte from this input stream, de-unsynchronizing the input as necessary. |
int |
read(byte[] b,
int off,
int len)
Reads len bytes from the input stream, starting to write them at offset off in the given byte array and de-unsynchronizing as necessary. |
long |
skip(long n)
Skips over and discards n bytes of data from the input stream. |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean skipIfNull
Constructor Detail |
---|
public UnsynchronizedInputStream(java.io.InputStream in)
in
- the InputStream instance from which the unsynchronized
bytes shall be read.Method Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- if an I/O error occurs.public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- the buffer to which data will be written.off
- the start offset at which the data will be written.len
- the number of bytes of data that should be read.
java.io.IOException
- if an I/O error occurs.public long skip(long n) throws java.io.IOException
This implementation attempts to skip exactly the number of bytes
requested, and will block until having skipped the correct number or
reaching the end of file. The actual number of
bytes skipped is returned and may be smaller than n
skip
in class java.io.FilterInputStream
n
- the number of bytes to skip in the input stream.
java.io.IOException
- if an I/O error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |