ch.randelshofer.media.iff
Class IFFOutputStream
java.lang.Object
java.io.OutputStream
ch.randelshofer.media.iff.IFFOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public class IFFOutputStream
- extends java.io.OutputStream
Facilitates writing of EA 85 IFF files.
Reference:
Commodore-Amiga, Inc. (1991) Amiga ROM Kernel Reference Manual. Devices.
Third Edition. Reading: Addison-Wesley.
- Version:
- 1.0 2010-12-26 Created.
- Author:
- Werner Randelshofer
|
Constructor Summary |
IFFOutputStream(javax.imageio.stream.ImageOutputStream out)
|
| Methods inherited from class java.io.OutputStream |
flush, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IFFOutputStream
public IFFOutputStream(javax.imageio.stream.ImageOutputStream out)
throws java.io.IOException
- Throws:
java.io.IOException
pushCompositeChunk
public void pushCompositeChunk(java.lang.String compositeType,
java.lang.String chunkType)
throws java.io.IOException
- Throws:
java.io.IOException
pushDataChunk
public void pushDataChunk(java.lang.String chunkType)
throws java.io.IOException
- Throws:
java.io.IOException
popChunk
public void popChunk()
throws java.io.IOException
- Throws:
java.io.IOException
finish
public void finish()
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
write in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(int b)
throws java.io.IOException
- Specified by:
write in class java.io.OutputStream
- Throws:
java.io.IOException
writeLONG
public void writeLONG(int v)
throws java.io.IOException
- Throws:
java.io.IOException
writeULONG
public void writeULONG(long v)
throws java.io.IOException
- Throws:
java.io.IOException
writeWORD
public void writeWORD(int v)
throws java.io.IOException
- Throws:
java.io.IOException
writeUWORD
public void writeUWORD(int v)
throws java.io.IOException
- Throws:
java.io.IOException
writeUBYTE
public void writeUBYTE(int v)
throws java.io.IOException
- Throws:
java.io.IOException
writeTYPE
public void writeTYPE(java.lang.String s)
throws java.io.IOException
- Writes an chunk type identifier (4 bytes).
- Parameters:
s - A string with a length of 4 characters.
- Throws:
java.io.IOException
writeByteRun1
public void writeByteRun1(byte[] data)
throws java.io.IOException
- ByteRun1 Run Encoding.
The run encoding scheme in 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 timees
-128 => no operation
ENDCASE
ENDLOOP
- Throws:
java.io.IOException
writeByteRun1
public void writeByteRun1(byte[] data,
int offset,
int length)
throws java.io.IOException
- Throws:
java.io.IOException