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

Quick Search    Search Deep

edu.emory.mathcs.util.security.io
Class SecureByteArrayOutputStream  view SecureByteArrayOutputStream download SecureByteArrayOutputStream.java

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.ByteArrayOutputStream
          extended byedu.emory.mathcs.util.security.io.SecureByteArrayOutputStream

public final class SecureByteArrayOutputStream
extends java.io.ByteArrayOutputStream

Variant of ByteArrayOutputStream that ensures that all data is cleared from temporary arrays before they are unreferenced. Hence, this class can be safely used to convert sensitive information into byte arrays, provided that it is closed 55 after use.

Version:
1.0

Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
SecureByteArrayOutputStream()
           
SecureByteArrayOutputStream(int size)
           
 
Method Summary
 void close()
          Closing a SecureByteArrayOutputStream causes it to be #reset(), i.e.
 void reset()
          Resets the count field of this byte array output stream to zero and clears up the entire buffer with zeros, so that all currently accumulated output in the ouput stream is discarded.
 void write(byte[] b, int off, int len)
          This method writes len bytes from the passed in array buf starting at index offset into the internal buffer.
 void write(int b)
          This method writes the writes the specified byte into the internal buffer.
 
Methods inherited from class java.io.ByteArrayOutputStream
size, toByteArray, toString, toString, toString, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SecureByteArrayOutputStream

public SecureByteArrayOutputStream()

SecureByteArrayOutputStream

public SecureByteArrayOutputStream(int size)
Method Detail

write

public void write(int b)
Description copied from class: java.io.ByteArrayOutputStream
This method writes the writes the specified byte into the internal buffer.


write

public void write(byte[] b,
                  int off,
                  int len)
Description copied from class: java.io.ByteArrayOutputStream
This method writes len bytes from the passed in array buf starting at index offset into the internal buffer.


reset

public void reset()
Resets the count field of this byte array output stream to zero and clears up the entire buffer with zeros, so that all currently accumulated output in the ouput stream is discarded. The output stream can be used again, reusing the already allocated buffer space.


close

public void close()
           throws java.io.IOException
Closing a SecureByteArrayOutputStream causes it to be #reset(), i.e. all data is discarded.