ImageWriters. Various output destinations, such as
OutputStreams and Files, as well as
future fast I/O destinations may be "wrapped" by a suitable
implementation of this interface for use by the Image I/O API.
Unlike a standard OutputStream, ImageOutputStream
extends its counterpart, ImageInputStream. Thus it is
possible to read from the stream as it is being written. The same
seek and flush positions apply to both reading and writing, although
the semantics for dealing with a non-zero bit offset before a byte-aligned
write are necessarily different from the semantics for dealing with
a non-zero bit offset before a byte-aligned read. When reading bytes,
any bit offset is set to 0 before the read; when writing bytes, a
non-zero bit offset causes the remaining bits in the byte to be written
as 0s. The byte-aligned write then starts at the next byte position.
ImageInputStream
| Modifier and Type | Method and Description |
|---|---|
| public void | flushBefore(long
a pos)long containing the length of the
stream prefix that may be flushed to the destination.Redeclares javax. Flushes all data prior to the given position to the underlying
destination, such as an |
| public void | write(int
an b)int whose lower 8 bits are to be
written.Redeclares java. Writes a single byte to the stream at the current position. |
| public void | write(byte[]
an array of b)bytes to be written.Redeclares java. Writes a sequence of bytes to the stream at the current position. |
| public void | write(byte[]
an array of b, int bytes to be written.the start offset in the data. off, int the number of len)bytes to write.Redeclares java. Writes a sequence of bytes to the stream at the current position. |
| public void | writeBit(int
an bit)int whose least significant bit
is to be written to the stream.Writes a single bit, given by the least significant bit of the argument, to the stream at the current bit offset within the current byte position. |
| public void | writeBits(long
a bits, int long containing the bits to be
written, starting with the bit in position numBits - 1
down to the least significant bit.an numBits)int between 0 and 64, inclusive.Writes a sequence of bits, given by the |
| public void | writeBoolean(boolean
the v)boolean to be written.Redeclares java. Writes a |
| public void | writeByte(int
an v)int containing the byte value to be
written.Redeclares java. Writes the 8 low-order bits of |
| public void | writeBytes(String
a s)String containing the value to be
written.Redeclares java. Writes a string to the output stream. |
| public void | writeChar(int
an v)int containing the char (unsigned
short) value to be written.Redeclares java. This method is a synonym for |
| public void | writeChars(String
a s)String containing the value to be
written.Redeclares java. Writes a string to the output stream. |
| public void | writeChars(char[]
an array of c, int chars to be written.the start offset in the data. off, int the number of len)chars to write.Writes a sequence of chars to the stream at the current position. |
| public void | writeDouble(double
a v)double containing the value to be
written.Redeclares java. Writes a |
| public void | writeDoubles(double[]
an array of d, int doubless to be written.the start offset in the data. off, int the number of len)doubles to write.Writes a sequence of doubles to the stream at the current position. |
| public void | writeFloat(float
a v)float containing the value to be
written.Redeclares java. Writes a |
| public void | writeFloats(float[]
an array of f, int floats to be written.the start offset in the data. off, int the number of len)floats to write.Writes a sequence of floats to the stream at the current position. |
| public void | writeInt(int
an v)int containing the value to be
written.Redeclares java. Writes the 32 bits of |
| public void | writeInts(int[]
an array of i, int ints to be written.the start offset in the data. off, int the number of len)ints to write.Writes a sequence of ints to the stream at the current position. |
| public void | writeLong(long
a v)long containing the value to be
written.Redeclares java. Writes the 64 bits of |
| public void | writeLongs(long[]
an array of l, int longs to be written.the start offset in the data. off, int the number of len)longs to write.Writes a sequence of longs to the stream at the current position. |
| public void | writeShort(int
an v)int containing the short value to be
written.Redeclares java. Writes the 16 low-order bits of |
| public void | writeShorts(short[]
an array of s, int shorts to be written.the start offset in the data. off, int the number of len)shorts to write.Writes a sequence of shorts to the stream at the current position. |
| public void | writeUTF(String
a s)String containing the value to be
written.Redeclares java. Writes two bytes of length information to the output stream in
network byte order, followed by the
modified UTF-8
representation of every character in the string |
| flushBefore | back to summary |
|---|---|
| public void flushBefore(long pos) throws IOException Redeclares javax. Flushes all data prior to the given position to the underlying
destination, such as an
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Redeclares java. Writes a single byte to the stream at the current position.
The 24 high-order bits of If the bit offset within the stream is non-zero, the
remainder of the current byte is padded with 0s
and written out first. The bit offset will be 0 after the
write. Implementers can use the
| |
| write | back to summary |
|---|---|
| public void write(byte[] b) throws IOException Redeclares java. Writes a sequence of bytes to the stream at the current
position. If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| write | back to summary |
|---|---|
| public void write(byte[] b, int off, int len) throws IOException Redeclares java. Writes a sequence of bytes to the stream at the current
position. If If the bit offset within the stream is non-zero, the
remainder of the current byte is padded with 0s
and written out first. The bit offset will be 0 after the
write. Implementers can use the
| |
| writeBit | back to summary |
|---|---|
| public void writeBit(int bit) throws IOException Writes a single bit, given by the least significant bit of the argument, to the stream at the current bit offset within the current byte position. The upper 31 bits of the argument are ignored. The given bit replaces the previous bit at that position. The bit offset is advanced by one and reduced modulo 8. If any bits of a particular byte have never been set at the time the byte is flushed to the destination, those bits will be set to 0 automatically.
| |
| writeBits | back to summary |
|---|---|
| public void writeBits(long bits, int numBits) throws IOException Writes a sequence of bits, given by the Bit data may be accumulated in memory indefinitely, until
If any bits of a particular byte have never been set at the time the byte is flushed to the destination, those bits will be set to 0 automatically.
| |
| writeBoolean | back to summary |
|---|---|
| public void writeBoolean(boolean v) throws IOException Redeclares java. Writes a If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeByte | back to summary |
|---|---|
| public void writeByte(int v) throws IOException Redeclares java. Writes the 8 low-order bits of If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeBytes | back to summary |
|---|---|
| public void writeBytes(String s) throws IOException Redeclares java. Writes a string to the output stream. For every character in
the string If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeChar | back to summary |
|---|---|
| public void writeChar(int v) throws IOException Redeclares java. This method is a synonym for
| |
| writeChars | back to summary |
|---|---|
| public void writeChars(String s) throws IOException Redeclares java. Writes a string to the output stream. For every character in
the string If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeChars | back to summary |
|---|---|
| public void writeChars(char[] c, int off, int len) throws IOException Writes a sequence of chars to the stream at the current
position. If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeDouble | back to summary |
|---|---|
| public void writeDouble(double v) throws IOException Redeclares java. Writes a If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeDoubles | back to summary |
|---|---|
| public void writeDoubles(double[] d, int off, int len) throws IOException Writes a sequence of doubles to the stream at the current
position. If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeFloat | back to summary |
|---|---|
| public void writeFloat(float v) throws IOException Redeclares java. Writes a If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeFloats | back to summary |
|---|---|
| public void writeFloats(float[] f, int off, int len) throws IOException Writes a sequence of floats to the stream at the current
position. If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeInt | back to summary |
|---|---|
| public void writeInt(int v) throws IOException Redeclares java. Writes the 32 bits of (byte)((v >> 24) & 0xff) (byte)((v >> 16) & 0xff) (byte)((v >> 8) & 0xff) (byte)(v & 0xff)Otherwise, the bytes written will be: (byte)(v & 0xff) (byte)((v >> 8) & 0xff) (byte)((v >> 16) & 0xff) (byte)((v >> 24) & 0xff) If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeInts | back to summary |
|---|---|
| public void writeInts(int[] i, int off, int len) throws IOException Writes a sequence of ints to the stream at the current
position. If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeLong | back to summary |
|---|---|
| public void writeLong(long v) throws IOException Redeclares java. Writes the 64 bits of (byte)((v >> 56) & 0xff) (byte)((v >> 48) & 0xff) (byte)((v >> 40) & 0xff) (byte)((v >> 32) & 0xff) (byte)((v >> 24) & 0xff) (byte)((v >> 16) & 0xff) (byte)((v >> 8) & 0xff) (byte)(v & 0xff)Otherwise, the bytes written will be: (byte)(v & 0xff) (byte)((v >> 8) & 0xff) (byte)((v >> 16) & 0xff) (byte)((v >> 24) & 0xff) (byte)((v >> 32) & 0xff) (byte)((v >> 40) & 0xff) (byte)((v >> 48) & 0xff) (byte)((v >> 56) & 0xff) If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeLongs | back to summary |
|---|---|
| public void writeLongs(long[] l, int off, int len) throws IOException Writes a sequence of longs to the stream at the current
position. If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeShort | back to summary |
|---|---|
| public void writeShort(int v) throws IOException Redeclares java. Writes the 16 low-order bits of (byte)((v >> 8) & 0xff) (byte)(v & 0xff)Otherwise, the bytes written will be: (byte)(v & 0xff) (byte)((v >> 8) & 0xff) If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeShorts | back to summary |
|---|---|
| public void writeShorts(short[] s, int off, int len) throws IOException Writes a sequence of shorts to the stream at the current
position. If If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write.
| |
| writeUTF | back to summary |
|---|---|
| public void writeUTF(String s) throws IOException Redeclares java. Writes two bytes of length information to the output stream in
network byte order, followed by the
modified UTF-8
representation of every character in the string If a character (byte)c If a character
If a character
First, the total number of bytes needed to represent all
the characters of The current byte order setting is ignored. If the bit offset within the stream is non-zero, the remainder of the current byte is padded with 0s and written out first. The bit offset will be 0 after the write. Note This method should not be used in the implementation of image formats that use standard UTF-8, because the modified UTF-8 used here is incompatible with standard UTF-8.
| |