java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.monte.media.iff.MC68000InputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
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.
- Author:
- Werner Randelshofer, Hausmatt 10, CH-6405 Goldau, Switzerland
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidalign()Align to an even byte position in the input stream.longgetScan()Get the current read position within the file (as seen by this input stream filter).voidmark(int readlimit) Marks the input stream.intread()Reads one byte.intread(byte[] b, int offset, int length) Reads a sequence of bytes.voidreadFully(byte[] b, int offset, int length) Reads a sequence of bytes.longRead 8 bytes from the input stream and interpret them as 64 Bit signed LONG LONG value.intreadLONG()Read 4 bytes from the input stream and interpret them as an MC 68000 32 Bit signed LONG value.intRead 1 byte from the input stream and interpret them as an MC 68000 8 Bit unsigned UBYTE value.longRead 4 Bytes from the input Stream and interpret them as an unsigned Integer value of MC 68000 type ULONG.intRead 2 bytes from the input stream and interpret them as an MC 68000 16 Bit unsigned UWORD value.shortreadWORD()Read 2 bytes from the input stream and interpret them as an MC 68000 16 Bit signed WORD value.voidreset()Repositions the stream at the previously marked position.longskip(long n) Skips over and discards n bytes of data from this input stream.voidskipFully(long n) Skips over and discards n bytes of data from this input stream.static intunpackByteRun1(byte[] in, byte[] out) ByteRun1 run decoder.Methods inherited from class java.io.FilterInputStream
available, close, markSupported, readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
MC68000InputStream
Creates a new instance.- Parameters:
in- the input stream.
-
-
Method Details
-
readUBYTE
Read 1 byte from the input stream and interpret them as an MC 68000 8 Bit unsigned UBYTE value.- Throws:
IOException
-
readWORD
Read 2 bytes from the input stream and interpret them as an MC 68000 16 Bit signed WORD value.- Throws:
IOException
-
readUWORD
Read 2 bytes from the input stream and interpret them as an MC 68000 16 Bit unsigned UWORD value.- Throws:
IOException
-
readLONG
Read 4 bytes from the input stream and interpret them as an MC 68000 32 Bit signed LONG value.- Throws:
IOException
-
readINT64
Read 8 bytes from the input stream and interpret them as 64 Bit signed LONG LONG value.- Throws:
IOException
-
readULONG
Read 4 Bytes from the input Stream and interpret them as an unsigned Integer value of MC 68000 type ULONG.- Throws:
IOException
-
align
Align to an even byte position in the input stream. This will skip one byte in the stream if the current read position is not even.- Throws:
IOException
-
getScan
public long getScan()Get the current read position within the file (as seen by this input stream filter). -
read
Reads one byte.- Overrides:
readin classFilterInputStream- Throws:
IOException
-
readFully
Reads a sequence of bytes.- Throws:
IOException
-
read
Reads a sequence of bytes.- Overrides:
readin classFilterInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) Marks the input stream.- Overrides:
markin classFilterInputStream- Parameters:
readlimit- The maximum limit of bytes that can be read before the mark position becomes invalid.
-
reset
Repositions the stream at the previously marked position.- Overrides:
resetin classFilterInputStream- Throws:
IOException- If the stream has not been marked or if the mark has been invalidated.
-
skip
Skips over and discards n bytes of data from this input stream. This skip method tries to skip the p- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
skipFully
Skips over and discards n bytes of data from this input stream. Throws- Parameters:
n- the number of bytes to be skipped.- Throws:
EOFException- if this input stream reaches the end before skipping all the bytes.IOException
-
unpackByteRun1
ByteRun1 run decoder.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;- Parameters:
in- inputout- output- Throws:
IOException
-