|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
com.kirkwarez.kirkpack.io.uru.wdys.WDYSInputStream
This stream streams in Uru WDYS encrypted data and streams out the decrypted data. Since the WDYS header has the length tag set, one can retrieve the eventual length of the data at any time.
Field Summary | |
protected byte[] |
block
The xTEA dual block buffer. |
private static int[] |
KEY
The key. |
protected int |
length
The length read from the header. |
protected int |
total
The total read from the stream. |
protected int |
unread
How much there's left to be read from the buffers. |
static String |
WDYS_HEADER
The WDYS header. |
Fields inherited from class java.io.FilterInputStream |
in |
Fields inherited from class java.io.InputStream |
|
Constructor Summary | |
WDYSInputStream(InputStream input)
Creates a stream over the given stream. |
Method Summary | |
int |
available()
Returns the number of bytes that can be read without blockage. |
protected int |
byteArrayToInt(byte[] bytes)
Makes a byte array of an int. |
protected byte[][] |
decrypt(byte[][] v)
The xTEA decryption algorithm. |
int |
getLength()
Returns the length of the unencrypted data as indicated by the header of the file. |
protected byte[] |
intToByteArray(int value)
Makes an int out of a byte array. |
int |
read()
Reads an unsigned byte and returns it as an int. |
int |
read(byte[] buffer,
int offset,
int length)
Fills the array with bytes from the stream. |
protected int |
readFromBuffer(byte[] buffer,
int offset,
int length)
Reads length bytes from the buffers and puts them in the given array from offset on. |
protected void |
setLength(int length)
Sets the length of the unencrypted data from the indication by the header of the file. |
long |
skip(long amount)
Skips the given amount of bytes, or at least tries to. |
Methods inherited from class java.io.FilterInputStream |
close, mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected byte[] block
protected int unread
protected int length
protected int total
private static int[] KEY
public static final String WDYS_HEADER
Constructor Detail |
public WDYSInputStream(InputStream input) throws IOException
input
- The stream to read from.
IOException
- When the given stream does not produce Uru data.Method Detail |
public int read() throws IOException
IOException
- When boo boo goes doo doo.InputStream.read()
public int read(byte[] buffer, int offset, int length) throws IOException
buffer
- The buffer to read the data into.offset
- The starting offset.length
- The amount of bytes to read.
IOException
- When boo boo goes doo doo.InputStream.read(byte[], int, int)
public long skip(long amount) throws IOException
IOException
InputStream.read(byte[], int, int)
,
InputStream.skip(long)
public int available() throws IOException
IOException
InputStream.available()
protected int readFromBuffer(byte[] buffer, int offset, int length) throws IOException
buffer
- The buffer to read the data into.offset
- The starting offset.length
- The amount of bytes to read.
IOException
- When your HDD explodes.protected byte[][] decrypt(byte[][] v)
v
- The encrypted input blocks.
protected byte[] intToByteArray(int value)
value
- The int to turn into a byte array.
protected int byteArrayToInt(byte[] bytes)
bytes
- The byte array to turn into an int.
public int getLength()
protected void setLength(int length)
length
- The length of the unencrypted data.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |