Ja.NET Standard Edition 5.0

Documentation API Specification

Contents

PasswordProtectedInputStream Class Reference

Inherits java::io::FilterInputStream.

List of all members.


Detailed Description

This class implements a password-protected input stream.

The algorithm used for protection is a Vigenere (repeated-key) cipher. The encrypted data is the result of <original data>=""> XOR KEYKEYKEY...


Public Member Functions

 PasswordProtectedInputStream (InputStream in, byte[] password)
 Constructs a new instance of the receiver.
int read () throws IOException
 Reads a single byte from this FilterInputStream and returns the result as an int.
int read (byte b[], int off, int len) throws IOException
 Reads at most length bytes from the Stream and stores them in byte array b starting at offset.
long skip (long n) throws IOException
 Skips count number of bytes in this InputStream.

Private Attributes

byte[] password
int pwdIndex

Constructor & Destructor Documentation

PasswordProtectedInputStream ( InputStream  in,
byte[]  password 
)

Constructs a new instance of the receiver.

Parameters:
in The actual input stream where to read the bytes from.
password The password bytes to use to decrypt the input bytes


Member Function Documentation

int read (  )  throws IOException [virtual]

Reads a single byte from this FilterInputStream and returns the result as an int.

The low-order byte is returned or -1 of the end of stream was encountered. This implementation returns a byte from the target stream.

Returns:
the byte read or -1 if end of stream.
Exceptions:
IOException If the stream is already closed or another IOException occurs.

Reimplemented from FilterInputStream.

int read ( byte  b[],
int  offset,
int  length 
) throws IOException

Reads at most length bytes from the Stream and stores them in byte array b starting at offset.

Answer the number of bytes actually read or -1 if no bytes were read and end of stream was encountered.

Parameters:
b the byte array in which to store the read bytes.
offset the offset in b to store the read bytes.
length the maximum number of bytes to store in b.
Returns:
the number of bytes actually read or -1 if end of stream.
Exceptions:
IOException If the stream is already closed or another IOException occurs.

Reimplemented from InputStream.

long skip ( long  count  )  throws IOException

Skips count number of bytes in this InputStream.

Subsequent read()'s will not return these bytes unless reset() is used. This implementation skips count number of bytes in the target stream.

Parameters:
count the number of bytes to skip.
Returns:
the number of bytes actually skipped.
Exceptions:
IOException If the stream is already closed or another IOException occurs.

Reimplemented from FilterInputStream.


Member Data Documentation

byte [] password [private]

int pwdIndex [private]