com.traxel.io
Class CopyrightedInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.traxel.io.CopyrightedInputStream
- All Implemented Interfaces:
- java.io.Closeable
- public class CopyrightedInputStream
- extends java.io.FilterInputStream
|
Method Summary |
protected void |
addCopyrightedDataBytes(byte[] byproductBytes)
This doesn't even vaguely respect the input byte[]. |
int |
available()
Returns super.available() / 2, which is the minimum
number of available bytes (the number of bytes
that are available if every byte is a key byte) |
protected void |
flushCopyrightedDataBuffer()
|
byte[] |
getCopyrightedDataBuffer()
Returns a byte array the size of the available bytes
in the copyrighted cache. |
boolean |
markSupported()
Mark is not supported. |
int |
read()
Reads the next available byte from the input stream. |
int |
read(byte[] buffer)
Calls read( buffer, 0, buffer.length ); |
int |
read(byte[] buffer,
int off,
int len)
Recursively calls read() |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_BUFFER_SIZE
protected static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
_bufferCopyrightedData
protected boolean _bufferCopyrightedData
_copyrightedDataBuffer
protected byte[] _copyrightedDataBuffer
_copyrightedDataBytesAvailable
protected int _copyrightedDataBytesAvailable
_mixer
protected StreamMixer _mixer
CopyrightedInputStream
public CopyrightedInputStream(java.io.InputStream in)
- Wraps the argument in a CopyrightedInputStream.
CopyrightedInputStream
public CopyrightedInputStream(java.io.InputStream in,
boolean bufferCopyrightedData)
- This constructor allows you to enable buffering
of the copyrighted data. This uses the default
buffer size of 1024 bytes, which is discarded
when the buffer fills, so be sure to take it
if you want it.
CopyrightedInputStream
public CopyrightedInputStream(java.io.InputStream in,
boolean bufferCopyrightedData,
int copyrightedDataBufferSize)
- Works just like the 2 arg constructor, but allows you
to specify a larger buffer.
read
public int read()
throws java.io.IOException
- Reads the next available byte from the input stream.
Handles the copyright byte if the byte is a key byte.
read
public int read(byte[] buffer)
throws java.io.IOException
- Calls read( buffer, 0, buffer.length );
read
public int read(byte[] buffer,
int off,
int len)
throws java.io.IOException
- Recursively calls read()
available
public int available()
throws java.io.IOException
- Returns super.available() / 2, which is the minimum
number of available bytes (the number of bytes
that are available if every byte is a key byte)
markSupported
public boolean markSupported()
- Mark is not supported. Returns false.
getCopyrightedDataBuffer
public byte[] getCopyrightedDataBuffer()
- Returns a byte array the size of the available bytes
in the copyrighted cache. Returns an array of size
zero if buffering is off or there is no data available.
addCopyrightedDataBytes
protected void addCopyrightedDataBytes(byte[] byproductBytes)
- This doesn't even vaguely respect the input byte[].
Make sure your buffer is large enough, and you
retrieve it frequently.
flushCopyrightedDataBuffer
protected void flushCopyrightedDataBuffer()