2008-10-21 14:00:00 +00:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership.
|
|
|
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
* (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @author Rustem V. Rafikov
|
|
|
|
* @version $Revision: 1.2 $
|
|
|
|
*/
|
2008-12-18 02:05:43 +00:00
|
|
|
|
2008-10-21 14:00:00 +00:00
|
|
|
package javax.imageio.stream;
|
|
|
|
|
|
|
|
import java.io.DataOutput;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* The ImageOutputStream represents output stream interface that is used by
|
|
|
|
* ImageWriters.
|
|
|
|
*
|
|
|
|
* @since Android 1.0
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
public interface ImageOutputStream extends DataOutput, ImageInputStream {
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a single byte to the stream at the current position.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param b
|
|
|
|
* the integer value, of which the 8 lowest bits will be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void write(int b) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes the bytes array to the stream.
|
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param b
|
|
|
|
* the byte array to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void write(byte[] b) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a number of bytes from the specified byte array beginning from the
|
|
|
|
* specified offset.
|
|
|
|
*
|
|
|
|
* @param b
|
|
|
|
* the byte array.
|
|
|
|
* @param off
|
|
|
|
* the offset.
|
|
|
|
* @param len
|
|
|
|
* the number of bytes to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void write(byte[] b, int off, int len) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes the specified boolean value to the stream, 1 if it is true, 0 if
|
|
|
|
* it is false.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param b
|
|
|
|
* the boolean value to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeBoolean(boolean b) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes the 8 lowest bits of the specified integer value to the stream.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param b
|
|
|
|
* the specified integer value.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeByte(int b) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a short value to the output stream.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param v
|
|
|
|
* the short value to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeShort(int v) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes the 16 lowest bits of the specified integer value to the stream.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param v
|
|
|
|
* the specified integer value.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeChar(int v) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes an integer value to the output stream.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param v
|
|
|
|
* the integer value to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeInt(int v) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write long.
|
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param v
|
|
|
|
* the long value.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeLong(long v) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a float value to the output stream.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param v
|
|
|
|
* the float which contains value to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeFloat(float v) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a double value to the output stream.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param v
|
|
|
|
* the double which contains value to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeDouble(double v) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes the specified string to the stream.
|
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param s
|
|
|
|
* the string to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeBytes(String s) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes the specified String to the output stream.
|
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param s
|
|
|
|
* the String to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeChars(String s) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes 2 bytes to the output stream in the modified UTF-8 representation
|
|
|
|
* of every character of the specified string.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param s
|
|
|
|
* the specified string to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeUTF(String s) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Flushes the initial position in this stream prior to the specified stream
|
|
|
|
* position.
|
2008-10-21 14:00:00 +00:00
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param pos
|
|
|
|
* the position.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void flushBefore(long pos) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a len number of short values from the specified array to the
|
|
|
|
* stream.
|
|
|
|
*
|
|
|
|
* @param s
|
|
|
|
* the shorts array to be written.
|
|
|
|
* @param off
|
|
|
|
* the offset in the char array.
|
|
|
|
* @param len
|
|
|
|
* the length of chars to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeShorts(short[] s, int off, int len) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes a len number of chars to the stream.
|
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param c
|
|
|
|
* the char array to be written.
|
|
|
|
* @param off
|
|
|
|
* the offset in the char array.
|
|
|
|
* @param len
|
|
|
|
* the length of chars to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeChars(char[] c, int off, int len) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a len number of integer values from the specified array to the
|
|
|
|
* stream.
|
|
|
|
*
|
|
|
|
* @param i
|
|
|
|
* the integer array to be written.
|
|
|
|
* @param off
|
|
|
|
* the offset in the char array.
|
|
|
|
* @param len
|
|
|
|
* the length of chars to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeInts(int[] i, int off, int len) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a len number of long values from the specified array to the
|
|
|
|
* stream.
|
|
|
|
*
|
|
|
|
* @param l
|
|
|
|
* the long array to be written.
|
|
|
|
* @param off
|
|
|
|
* the offset in the char array.
|
|
|
|
* @param len
|
|
|
|
* the length of chars to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeLongs(long[] l, int off, int len) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a len number of float values from the specified array to the
|
|
|
|
* stream.
|
|
|
|
*
|
|
|
|
* @param f
|
|
|
|
* the float array to be written.
|
|
|
|
* @param off
|
|
|
|
* the offset in the char array.
|
|
|
|
* @param len
|
|
|
|
* the length of chars to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeFloats(float[] f, int off, int len) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a len number of double values from the specified array to the
|
|
|
|
* stream.
|
|
|
|
*
|
|
|
|
* @param d
|
|
|
|
* the double array to be written.
|
|
|
|
* @param off
|
|
|
|
* the offset in the char array.
|
|
|
|
* @param len
|
|
|
|
* the length of chars to be written.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeDoubles(double[] d, int off, int len) throws IOException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes a single bit at the current position.
|
|
|
|
*
|
2008-12-18 02:05:43 +00:00
|
|
|
* @param bit
|
|
|
|
* the integer whose least significant bit is to be written to
|
|
|
|
* the stream.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeBit(int bit) throws IOException;
|
|
|
|
|
|
|
|
/**
|
2008-12-18 02:05:43 +00:00
|
|
|
* Writes a sequence of bits beginning from the current position.
|
|
|
|
*
|
|
|
|
* @param bits
|
|
|
|
* the long value containing the bits to be written, starting
|
|
|
|
* with the bit in position numBits - 1 down to the least
|
|
|
|
* significant bit.
|
|
|
|
* @param numBits
|
|
|
|
* the number of significant bit, it can be between 0 and 64.
|
|
|
|
* @throws IOException
|
|
|
|
* if an I/O exception has occurred.
|
2008-10-21 14:00:00 +00:00
|
|
|
*/
|
|
|
|
void writeBits(long bits, int numBits) throws IOException;
|
|
|
|
|
|
|
|
}
|