All Packages Class Hierarchy This Package Previous Next Index
Class sdsu.io.XorOutputStream
java.lang.Object
|
+----java.io.OutputStream
|
+----java.io.FilterOutputStream
|
+----sdsu.io.XorOutputStream
- public class XorOutputStream
- extends FilterOutputStream
XorOutputStream encodes it output by Xoring all input bytes
with the byte mask given in the constructor.
Use a XorInputStream to decode the output of XorOutputStream
by givening them both the same mask in their constructors.
XorInputStream and
XorOutputStream can be used for a very weak form of encryption.
- Version:
- 1.0 14 Feb 1998
- Author:
- Roger Whitney
(whitney@cs.sdsu.edu)
-
XorOutputStream(OutputStream, byte)
-
-
write(byte[], int, int)
- Writes
length
bytes from the specified
byte
array starting at offset offset
and Xor's each byte with the streams mask.
-
write(int)
- Writes the specified
byte
and Xor's it with the
streams mask.
XorOutputStream
public XorOutputStream(OutputStream out,
byte mask)
write
public void write(int output) throws IOException
- Writes the specified
byte
and Xor's it with the
streams mask.
- Parameters:
- output - the
byte
.
- Throws: IOException
- if an I/O error occurs.
- Overrides:
- write in class FilterOutputStream
write
public void write(byte output[],
int offset,
int length) throws IOException
- Writes
length
bytes from the specified
byte
array starting at offset offset
and Xor's each byte with the streams mask.
- Parameters:
- output - the data.
- offset - the start offset in the data.
- length - the number of bytes to write.
- Throws: IOException
- if an I/O error occurs.
- Overrides:
- write in class FilterOutputStream
All Packages Class Hierarchy This Package Previous Next Index