edu.vt.middleware.crypt.io
Class AbstractEncodingFilterOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by edu.vt.middleware.crypt.io.AbstractEncodingFilterOutputStream
All Implemented Interfaces:
Closeable, Flushable
Direct Known Subclasses:
Base64FilterOutputStream, HexFilterOutputStream

public abstract class AbstractEncodingFilterOutputStream
extends FilterOutputStream

Abstract base class for filter output streams that convert raw bytes into encoded characters.

Version:
$Revision: 2744 $
Author:
Middleware Services

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
protected AbstractEncodingFilterOutputStream(OutputStream out)
          Creates an output filter that encodes raw bytes into encoded character bytes in the wrapped output stream.
 
Method Summary
 void write(byte[] b)
          
 void write(byte[] b, int off, int len)
          
 void write(int b)
          
protected abstract  void writeEncoded(byte[] data, int offset, int length)
          Encode the given raw bytes and write the result to the wrapped output stream.
 
Methods inherited from class java.io.FilterOutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEncodingFilterOutputStream

protected AbstractEncodingFilterOutputStream(OutputStream out)
Creates an output filter that encodes raw bytes into encoded character bytes in the wrapped output stream.

Parameters:
out - Output stream to wrap.
Method Detail

write

public void write(int b)
           throws IOException

Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException

Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException

Overrides:
write in class FilterOutputStream
Throws:
IOException

writeEncoded

protected abstract void writeEncoded(byte[] data,
                                     int offset,
                                     int length)
                              throws IOException
Encode the given raw bytes and write the result to the wrapped output stream.

Parameters:
data - Raw bytes to be encoded and written.
offset - Starting index of data to be written in input byte array.
length - Number of bytes to be written from input byte array.
Throws:
IOException - On write errors.


Copyright © 2003-2013 Virginia Tech. All Rights Reserved.