Source for javax.imageio.stream.ImageOutputStream

   1: /* ImageOutputStream.java
   2:    Copyright (C) 2004, 2005  Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package javax.imageio.stream;
  40: 
  41: import java.io.DataOutput;
  42: import java.io.IOException;
  43: 
  44: 
  45: /**
  46:  * An output stream for use by {@link javax.imageio.ImageWriter
  47:  * ImageWriters}.
  48:  *
  49:  * @since 1.4
  50:  *
  51:  * @author Sascha Brawer (brawer@dandelis.ch)
  52:  */
  53: public interface ImageOutputStream
  54:   extends ImageInputStream, DataOutput
  55: {
  56:   /**
  57:    * @param position
  58:    *
  59:    * @throws IOException if an errror occurs
  60:    */
  61:   void flushBefore(long position) throws IOException;
  62: 
  63:   /**
  64:    * Writes an array into the stream.
  65:    *
  66:    * @param data the data to be written
  67:    *
  68:    * @throws IOException if an errror occurs
  69:    */
  70:   void write(byte[] data) throws IOException;
  71: 
  72:   /**
  73:    * Writes a region of data from an array into the stream.
  74:    *
  75:    * @param data the data to be written
  76:    * @param offset the offset in the array
  77:    * @param len the length in the array
  78:    *
  79:    * @throws IOException if an errror occurs
  80:    */
  81:   void write(byte[] data, int offset, int len) throws IOException;
  82: 
  83:   /**
  84:    * Writes an <code>int</code> into the stream.
  85:    *
  86:    * @param data the data to be written
  87:    *
  88:    * @throws IOException if an errror occurs
  89:    */
  90:   void write(int data) throws IOException;
  91: 
  92:   /**
  93:    * Writes a bit value to the stream.
  94:    *
  95:    * @throws IOException if an error occurs
  96:    */
  97:   void writeBit(int bit) throws IOException;
  98: 
  99:   /**
 100:    * Writes a number of bit values to the stream.
 101:    *
 102:    * @throws IOException if an errror occurs
 103:    */
 104:   void writeBits(long bits, int numBits) throws IOException;
 105: 
 106:   /**
 107:    * Writes a <code>boolean</code> value into the stream.
 108:    *
 109:    * @param data the data to be written
 110:    *
 111:    * @throws IOException if an errror occurs
 112:    */
 113:   void writeBoolean(boolean data) throws IOException;
 114: 
 115:   /**
 116:    * Writes a <code>byte</code> value into the stream.
 117:    *
 118:    * @param data the data to be written
 119:    *
 120:    * @throws IOException if an errror occurs
 121:    */
 122:   void writeByte(int data) throws IOException;
 123: 
 124:   /**
 125:    * @param data the data to be written
 126:    *
 127:    * @throws IOException if an errror occurs
 128:    */
 129:   void writeBytes(String data) throws IOException;
 130: 
 131:   /**
 132:    * Writes a character into the stream.
 133:    *
 134:    * @param data the data to be written
 135:    *
 136:    * @throws IOException if an errror occurs
 137:    */
 138:   void writeChar(int data) throws IOException;
 139: 
 140:   /**
 141:    * Writes characters to the stream.
 142:    *
 143:    * @param data the data to be written
 144:    * @param offset the offset in the array
 145:    * @param len the lenth in the array
 146:    *
 147:    * @throws IOException if an errror occurs
 148:    */
 149:   void writeChars(char[] data, int offset, int len) throws IOException;
 150: 
 151:   /**
 152:    * Writes characters from a given <code>String</code> into the stream.
 153:    *
 154:    * @param data the data to be written
 155:    *
 156:    * @throws IOException if an errror occurs
 157:    */
 158:   void writeChars(String data) throws IOException;
 159: 
 160:   /**
 161:    * Writes a <code>double</code> into the stream.
 162:    *
 163:    * @param data the data to be written
 164:    *
 165:    * @throws IOException if an errror occurs
 166:    */
 167:   void writeDouble(double data) throws IOException;
 168: 
 169:   /**
 170:    * Writes an array of <code>double</code> into the stream.
 171:    *
 172:    * @param data the data to be written
 173:    * @param offset the offset in the array
 174:    * @param len the lenth in the array
 175:    *
 176:    * @throws IOException if an errror occurs
 177:    */
 178:   void writeDoubles(double[] data, int offset, int len)
 179:     throws IOException;
 180: 
 181:   /**
 182:    * Writes a <code>float</code> into the stream.
 183:    *
 184:    * @param data the data to be written
 185:    *
 186:    * @throws IOException if an errror occurs
 187:    */
 188:   void writeFloat(float data) throws IOException;
 189: 
 190:   /**
 191:    * Writes an array of <code>float</code> into the stream.
 192:    *
 193:    * @param data the data to be written
 194:    * @param offset the offset in the array
 195:    * @param len the lenth in the array
 196:    *
 197:    * @throws IOException if an errror occurs
 198:    */
 199:   void writeFloats(float[] data, int offset, int len) throws IOException;
 200: 
 201:   /**
 202:    * Writes a <code>int</code> into the stream.
 203:    *
 204:    * @param data the data to be written
 205:    *
 206:    * @throws IOException if an errror occurs
 207:    */
 208:   void writeInt(int data) throws IOException;
 209: 
 210:   /**
 211:    * Writes an array of <code>int</code> into the stream.
 212:    *
 213:    * @param data the data to be written
 214:    * @param offset the offset in the array
 215:    * @param len the lenth in the array
 216:    *
 217:    * @throws IOException if an errror occurs
 218:    */
 219:   void writeInts(int[] data, int offset, int len) throws IOException;
 220: 
 221:   /**
 222:    * Writes a <code>long</code> into the stream.
 223:    *
 224:    * @param data the data to be written
 225:    *
 226:    * @throws IOException if an errror occurs
 227:    */
 228:   void writeLong(long data) throws IOException;
 229: 
 230:   /**
 231:    * Writes an array of <code>long</code> into the stream.
 232:    *
 233:    * @param data the data to be written
 234:    * @param offset the offset in the array
 235:    * @param len the lenth in the array
 236:    *
 237:    * @throws IOException if an errror occurs
 238:    */
 239:   void writeLongs(long[] data, int offset, int len) throws IOException;
 240: 
 241:   /**
 242:    * Writes a <code>short</code> into the stream.
 243:    *
 244:    * @param data the data to be written
 245:    *
 246:    * @throws IOException if an errror occurs
 247:    */
 248:   void writeShort(int data) throws IOException;
 249: 
 250:   /**
 251:    * Writes an array of <code>short</code> into the stream.
 252:    *
 253:    * @param data the data to be written
 254:    * @param offset the offset in the array
 255:    * @param len the lenth in the array
 256:    *
 257:    * @throws IOException if an errror occurs
 258:    */
 259:   void writeShorts(short[] data, int offset, int len) throws IOException;
 260: 
 261:   /**
 262:    * Writes a <code>String</code> into the stream.
 263:    *
 264:    * @param data the data to be written
 265:    *
 266:    * @throws IOException if an errror occurs
 267:    */
 268:   void writeUTF(String data) throws IOException;
 269: }