All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sdsu.io.XorWriter

java.lang.Object
   |
   +----java.io.Writer
           |
           +----java.io.FilterWriter
                   |
                   +----sdsu.io.XorWriter

public class XorWriter
extends FilterWriter
XorWriter encodes it output by Xoring all input chars with the char mask given in the constructor. Use a XorReader to decode the output of XorWriter by givening them both the same mask in their constructors. XorReader and XorWriter can be used for a very weak form of encryption.

Version:
1.0 14 Feb 1998
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Index

 o XorWriter(Writer, char)

Method Index

 o write(char[], int, int)
Writes length chars from the specified char array starting at offset offset and Xor's each char with the stream's mask.
 o write(int)
Writes the specified char and Xor's it with the stream's mask.
 o write(String, int, int)
Writes length chars from the specified string starting at offset offset and Xor's each char with the stream's mask.

Constructors

 o XorWriter
 public XorWriter(Writer out,
                  char mask)

Methods

 o write
 public void write(int output) throws IOException
Writes the specified char and Xor's it with the stream's mask.

Parameters:
output - the char.
Throws: IOException
if an I/O error occurs.
Overrides:
write in class FilterWriter
 o write
 public void write(char output[],
                   int offset,
                   int length) throws IOException
Writes length chars from the specified char array starting at offset offset and Xor's each char with the stream's mask.

Parameters:
output - the data.
offset - the start offset in the data.
length - the number of chars to write.
Throws: IOException
if an I/O error occurs.
Overrides:
write in class FilterWriter
 o write
 public void write(String output,
                   int offset,
                   int length) throws IOException
Writes length chars from the specified string starting at offset offset and Xor's each char with the stream's mask.

Parameters:
output - the data.
offset - the start offset in the data.
length - the number of chars to write.
Throws: IOException
if an I/O error occurs.
Overrides:
write in class FilterWriter

All Packages  Class Hierarchy  This Package  Previous  Next  Index