mediaframe.mpeg1
Class CryptedInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--mediaframe.mpeg1.CryptedInputStream

public final class CryptedInputStream
extends java.io.FilterInputStream

The CryptedInputStream class implements decryption function of the MPEG stream.


Field Summary
private  int encryption_index
          The current index in the encryption key.
private  byte[] encryption_key
          The array of bytes (encryption key) which are used for encription of the movie stream.
 
Fields inherited from class java.io.FilterInputStream
in
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
CryptedInputStream(java.io.InputStream in)
          Constructor of the CryptedInputStream class.
 
Method Summary
 int read()
          Reads one byte from the input stream and decrypts it using xor 0x55 operation.
 int read(byte[] b)
          Reads n bytes from the input stream into the buffer b and decrypts them using xor 0x55 operation
 int read(byte[] b, int off, int len)
          Reads len bytes from the input stream into the buffer b starting from the offset off and decrypts them using xor 0x55 operation
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encryption_index

private int encryption_index
The current index in the encryption key.


encryption_key

private byte[] encryption_key
The array of bytes (encryption key) which are used for encription of the movie stream.

Constructor Detail

CryptedInputStream

public CryptedInputStream(java.io.InputStream in)
                   throws java.lang.Exception
Constructor of the CryptedInputStream class.

Parameters:
in - the MPEG input stream which is decrypted.
Throws:
java.lang.Exception - raises if an error occurs during initialization.
Method Detail

read

public int read()
         throws java.io.IOException
Reads one byte from the input stream and decrypts it using xor 0x55 operation.

Overrides:
read in class java.io.FilterInputStream
Returns:
readed and decrypted byte.
Throws:
java.io.IOException - if an I/O error occurs.

read

public int read(byte[] b)
         throws java.io.IOException
Reads n bytes from the input stream into the buffer b and decrypts them using xor 0x55 operation

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - the buffer into which the data is read.
Returns:
the number of bytes read into the buffer or -1 if the end of the file is reached.
Throws:
java.io.IOException - if an I/O error occurs.

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads len bytes from the input stream into the buffer b starting from the offset off and decrypts them using xor 0x55 operation

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - the buffer into which the data is read.
off - the start offset in the array b.
len - the number of the bytes to read.
Returns:
the number of bytes read into the buffer or -1 if the end of the file is reached.
Throws:
java.io.IOException - if an I/O error occurs.