java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
edu.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
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. |
SecureByteArrayOutputStream
public SecureByteArrayOutputStream()
SecureByteArrayOutputStream
public SecureByteArrayOutputStream(int size)
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.