WDYSDecrypt
Class WDYSEncryptedFileReader

java.lang.Object
  extended byWDYSDecrypt.WDYSEncryptedFileReader

public class WDYSEncryptedFileReader
extends Object

This class reads encrypted WDYS files, isolates the encrypted data chunk and provides methods for data retrieval and stuff.

Version:
1
Author:
Berend "Kirk" Wouda

Field Summary
protected  File encryptedfile
          The file.
protected  long length
          The length of the decrypted data chunk (stored seperately in the file).
protected  BufferedInputStream reader
          The reader.
 
Constructor Summary
WDYSEncryptedFileReader(String filename)
          Constructs a new file reader around the given file.
 
Method Summary
 void close()
          Closes the file.
 long getDecryptedDataLength()
          Returns the length of the decrypted data chunk (it is stored seperately).
 long getEncryptedDataLength()
          Returns the length of the encrypted data chunk.
 byte[] read4EncryptedDataBytes()
          Reads and returns the next 4 bytes from the encrypted data chunk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

length

protected long length
The length of the decrypted data chunk (stored seperately in the file).


encryptedfile

protected File encryptedfile
The file.


reader

protected BufferedInputStream reader
The reader. Well it's a stream actually.

Constructor Detail

WDYSEncryptedFileReader

public WDYSEncryptedFileReader(String filename)
                        throws IOException,
                               WDYSDecryptException
Constructs a new file reader around the given file.

Parameters:
filename - The name of the encrypted file.
Throws:
IOException - When IO stuff goes wrong.
WDYSDecryptException - When the header could not be skipped.
Method Detail

close

public void close()
           throws IOException
Closes the file.

Throws:
IOException - When IO stuff goes wrong.

getEncryptedDataLength

public long getEncryptedDataLength()
Returns the length of the encrypted data chunk.

Returns:
Said length.

getDecryptedDataLength

public long getDecryptedDataLength()
Returns the length of the decrypted data chunk (it is stored seperately). This is neccesary because the decrypted data is padded with random data to fit a multiple of 8 bytes.

Returns:
Said length.

read4EncryptedDataBytes

public byte[] read4EncryptedDataBytes()
                               throws IOException,
                                      WDYSDecryptException
Reads and returns the next 4 bytes from the encrypted data chunk.

Returns:
What I just said above, jeez.
Throws:
IOException - When IO stuff goes wrong.
WDYSDecryptException - When the full 4 bytes could not be read.