Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.traxel.io
Class CopyrightedInputStream  view CopyrightedInputStream download CopyrightedInputStream.java

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended bycom.traxel.io.CopyrightedInputStream
All Implemented Interfaces:
java.io.Closeable

public class CopyrightedInputStream
extends java.io.FilterInputStream


Field Summary
protected  boolean _bufferCopyrightedData
           
protected  byte[] _copyrightedDataBuffer
           
protected  int _copyrightedDataBytesAvailable
           
protected  StreamMixer _mixer
           
protected static int DEFAULT_BUFFER_SIZE
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CopyrightedInputStream(java.io.InputStream in)
          Wraps the argument in a CopyrightedInputStream.
CopyrightedInputStream(java.io.InputStream in, boolean bufferCopyrightedData)
          This constructor allows you to enable buffering of the copyrighted data.
CopyrightedInputStream(java.io.InputStream in, boolean bufferCopyrightedData, int copyrightedDataBufferSize)
          Works just like the 2 arg constructor, but allows you to specify a larger buffer.
 
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.io.FilterInputStream
close, mark, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

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.

Method Detail

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()