jautil
Class JAOutputStream

java.lang.Object
  extended by jautil.JAOutputStream

public class JAOutputStream
extends java.lang.Object

A Java ARP output-stream wraps a standard output-stream, and provides little-endian binary output methods for values of several primitive types.


Constructor Summary
JAOutputStream(java.io.File file)
          Constructs this stream, based on the given file.
JAOutputStream(java.io.OutputStream outs)
          Constructs this Java ARP output-stream, using the given stream as its underlying stream, which is assumed not to be buffered.
JAOutputStream(java.io.OutputStream outs, boolean isbuffered)
          Constructs this Java ARP output-stream, using the given stream as its underlying stream, which is assumed to be buffered or not, as specified.
JAOutputStream(java.lang.String path)
          Constructs this stream, based on the file with the given path name.
 
Method Summary
 void close()
          Flushes and closes this stream.
 void completeGZIPBlock()
          Completes the current GZIP block by
 void startGZIPBlock(int capacity)
          startGZIPBlock with a size prefix attached.
 void startGZIPBlock(int capacity, boolean doszpfx)
          Switch to GZIP mode, causing subsequent output on this Java ARP stream to have GZIP compression applied to it; capacity is the estimated size of the compressed block to be generated, and the flag doszpfx indicates whether or not the compressed block is to be prefixed with an int value giving its size in bytes when it is finally output to this Java ARP stream's underlying stream.
 void write4CCString(int tag)
          Writes a Four-CC value as a string (standard ARP format).
 void writeBoolean(boolean b)
          Writes a boolean value to this stream (as a single byte).
 void writeBuf(byte[] bb, int pos, int n)
          Writes the given byte-sequence to this.stream.
 void writeByteBuffer(java.nio.ByteBuffer bbuf)
          Writes the given Java NIO byte-buffer to this.stream.
 void writeFloat(float f)
          Writes a floating-point value to this stream.
 void writeInt(int i)
          Writes an integer value (4-byte, little-endian) to this stream.
 void writePNGImage(java.awt.image.BufferedImage bimg)
          Writes the given PNG image to this stream.
 void writeString(java.lang.String s)
          Writes a string to this stream in standard ARP format, that is, length (integer), followed by (ISO-8859-1/ASCII) bytes.
 void writeUnsignedShort(short s)
          Writes an integer value (4-byte, little-endian) to this stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAOutputStream

public JAOutputStream(java.lang.String path)
               throws java.io.IOException
Constructs this stream, based on the file with the given path name.

Throws:
java.io.IOException

JAOutputStream

public JAOutputStream(java.io.File file)
               throws java.io.IOException
Constructs this stream, based on the given file.

Throws:
java.io.IOException

JAOutputStream

public JAOutputStream(java.io.OutputStream outs)
               throws java.io.IOException
Constructs this Java ARP output-stream, using the given stream as its underlying stream, which is assumed not to be buffered.

Throws:
java.io.IOException

JAOutputStream

public JAOutputStream(java.io.OutputStream outs,
                      boolean isbuffered)
               throws java.io.IOException
Constructs this Java ARP output-stream, using the given stream as its underlying stream, which is assumed to be buffered or not, as specified.

Throws:
java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Flushes and closes this stream.

Throws:
java.io.IOException

writeBoolean

public void writeBoolean(boolean b)
                  throws java.io.IOException
Writes a boolean value to this stream (as a single byte).

Throws:
java.io.IOException

writeInt

public void writeInt(int i)
              throws java.io.IOException
Writes an integer value (4-byte, little-endian) to this stream.

Throws:
java.io.IOException

writeUnsignedShort

public void writeUnsignedShort(short s)
                        throws java.io.IOException
Writes an integer value (4-byte, little-endian) to this stream.

Throws:
java.io.IOException

writeFloat

public void writeFloat(float f)
                throws java.io.IOException
Writes a floating-point value to this stream.

Throws:
java.io.IOException

writeString

public void writeString(java.lang.String s)
                 throws java.io.IOException
Writes a string to this stream in standard ARP format, that is, length (integer), followed by (ISO-8859-1/ASCII) bytes.

Throws:
java.io.IOException

write4CCString

public void write4CCString(int tag)
                    throws java.io.IOException
Writes a Four-CC value as a string (standard ARP format).

Throws:
java.io.IOException

writeBuf

public void writeBuf(byte[] bb,
                     int pos,
                     int n)
              throws java.io.IOException
Writes the given byte-sequence to this.stream.

Throws:
java.io.IOException

writeByteBuffer

public void writeByteBuffer(java.nio.ByteBuffer bbuf)
                     throws java.io.IOException
Writes the given Java NIO byte-buffer to this.stream.

Throws:
java.io.IOException

writePNGImage

public void writePNGImage(java.awt.image.BufferedImage bimg)
                   throws java.io.IOException
Writes the given PNG image to this stream.

Throws:
java.io.IOException

startGZIPBlock

public void startGZIPBlock(int capacity)
                    throws java.io.IOException
startGZIPBlock with a size prefix attached.

Throws:
java.io.IOException

startGZIPBlock

public void startGZIPBlock(int capacity,
                           boolean doszpfx)
                    throws java.io.IOException
Switch to GZIP mode, causing subsequent output on this Java ARP stream to have GZIP compression applied to it; capacity is the estimated size of the compressed block to be generated, and the flag doszpfx indicates whether or not the compressed block is to be prefixed with an int value giving its size in bytes when it is finally output to this Java ARP stream's underlying stream.

Throws:
java.io.IOException

completeGZIPBlock

public void completeGZIPBlock()
                       throws java.io.IOException
Completes the current GZIP block by

Throws:
java.io.IOException