|
Copyright 2011-01-06 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
ch.randelshofer.media.iff.MC68000InputStream
public class MC68000InputStream
A MC 68000 input stream lets an application read primitive data types in the MC 68000 CPU format from an underlying input stream.
This stream filter is suitable for IFF-EA85 files.
| Field Summary |
|---|
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
MC68000InputStream(java.io.InputStream in)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
align()
Align to an even byte position in the input stream. |
long |
getScan()
Get the current read position within the file (as seen by this input stream filter). |
void |
mark(int readlimit)
Marks the input stream. |
int |
read()
Reads one byte. |
int |
read(byte[] b,
int offset,
int length)
Reads a sequence of bytes. |
int |
readFully(byte[] b,
int offset,
int length)
Reads a sequence of bytes. |
int |
readLONG()
Read 4 bytes from the input stream and interpret them as an MC 68000 32 Bit signed LONG value. |
int |
readUBYTE()
Read 1 byte from the input stream and interpret them as an MC 68000 8 Bit unsigned UBYTE value. |
long |
readULONG()
Read 4 Bytes from the input Stream and interpret them as an unsigned Integer value of MC 68000 type ULONG. |
int |
readUWORD()
Read 2 bytes from the input stream and interpret them as an MC 68000 16 Bit unsigned UWORD value. |
short |
readWORD()
Read 2 bytes from the input stream and interpret them as an MC 68000 16 Bit signed WORD value. |
void |
reset()
Repositions the stream at the previously marked position. |
long |
skip(long n)
Skips over and discards n bytes of data from this input stream. |
void |
skipFully(long n)
Skips over and discards n bytes of data from this input stream. |
static int |
unpackByteRun1(byte[] in,
byte[] out)
ByteRun1 run decoder. |
| Methods inherited from class java.io.FilterInputStream |
|---|
available, close, markSupported, read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MC68000InputStream(java.io.InputStream in)
in - the input stream.| Method Detail |
|---|
public int readUBYTE()
throws java.io.IOException
java.io.IOException
public short readWORD()
throws java.io.IOException
java.io.IOException
public int readUWORD()
throws java.io.IOException
java.io.IOException
public int readLONG()
throws java.io.IOException
java.io.IOException
public long readULONG()
throws java.io.IOException
java.io.IOException
public void align()
throws java.io.IOException
java.io.IOExceptionpublic long getScan()
public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOException
public int readFully(byte[] b,
int offset,
int length)
throws java.io.IOException
java.io.IOException
public int read(byte[] b,
int offset,
int length)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic void mark(int readlimit)
mark in class java.io.FilterInputStreamreadlimit - The maximum limit of bytes that can be read before
the mark position becomes invalid.
public void reset()
throws java.io.IOException
reset in class java.io.FilterInputStreamjava.io.IOException - If the stream has not been marked or if the
mark has been invalidated.
public long skip(long n)
throws java.io.IOException
skip in class java.io.FilterInputStreamjava.io.IOException
public void skipFully(long n)
throws java.io.IOException
n - the number of bytes to be skipped.
java.io.EOFException - if this input stream reaches the end before
skipping all the bytes.
java.io.IOException
public static int unpackByteRun1(byte[] in,
byte[] out)
throws java.io.IOException
The run encoding scheme by byteRun1 is best described by pseudo code for the decoder Unpacker (called UnPackBits in the Macintosh toolbox.
UnPacker:
LOOP until produced the desired number of bytes
Read the next source byte into n
SELECT n FROM
[0..127] => copy the next n+1 bytes literally
[-1..-127] => replicate the next byte -n+1 times
-128 => no operation
ENDCASE;
ENDLOOP;
in - out -
ParseException
java.io.IOException
|
Copyright 2011-01-06 Werner Randelshofer | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||