sam.io
Class ByteArrayFilter

java.lang.Object
  |
  +--sam.io.ByteArrayFilter
Direct Known Subclasses:
Cipher.ByteArrayFilter, MultiThreadedByteArrayFilter

public abstract class ByteArrayFilter
extends java.lang.Object

Abstract class for filtering byte[] arrays


Nested Class Summary
 class ByteArrayFilter.InputStream
          Instance inner-class for filtering an InputStream with outer-instance's filter, as in:
 class ByteArrayFilter.OutputStream
          Instance inner-class for filtering an OutputStream with outer-instance's filter, as in:
 
Field Summary
protected  int length
          Length of a block size
 
Constructor Summary
protected ByteArrayFilter(int length)
           
 
Method Summary
protected  void fillRandomly(byte[] data, int start, int end)
          Called whenever the whole buffer can not be filled up with fresh data.
 void filter(byte[] data)
           
protected abstract  void filter(byte[] data, int offset)
          Filters the data byte[] array from position offset up to offset + length - 1.
 void filter(byte[] data, int begin, int end)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

protected final int length
Length of a block size

Constructor Detail

ByteArrayFilter

protected ByteArrayFilter(int length)
Method Detail

filter

protected abstract void filter(byte[] data,
                               int offset)
Filters the data byte[] array from position offset up to offset + length - 1.


filter

public void filter(byte[] data)

filter

public void filter(byte[] data,
                   int begin,
                   int end)

fillRandomly

protected void fillRandomly(byte[] data,
                            int start,
                            int end)
Called whenever the whole buffer can not be filled up with fresh data.

To be overriden as required.

This implementation fills up remaining bytes with random data.