javax.imageio.stream
类 ImageOutputStreamImpl

java.lang.Object
  继承者 javax.imageio.stream.ImageInputStreamImpl
      继承者 javax.imageio.stream.ImageOutputStreamImpl
所有已实现的接口:
DataInput, DataOutput, ImageInputStream, ImageOutputStream
直接已知子类:
FileCacheImageOutputStream, FileImageOutputStream, MemoryCacheImageOutputStream

public abstract class ImageOutputStreamImpl
   
   
   
extends ImageInputStreamImpl
implements ImageOutputStream

实现 ImageOutputStream 接口的抽象类。此类设计用于减少必须由子类实现的方法数。


字段摘要
 
从类 javax.imageio.stream.ImageInputStreamImpl 继承的字段
bitOffset, byteOrder, flushedPos, streamPos
 
构造方法摘要
ImageOutputStreamImpl()
          构造一个 ImageOutputStreamImpl
 
方法摘要
protected  voidflushBits()
          如果位偏移量为非零,则将当前字节中的剩余位强制归 0,并将流位置前移一个字节。
 voidwrite(byte[] b)
          将字节序列写入到流中的当前位置。
abstract  voidwrite(byte[] b, int off, int len)
          将字节序列写入到流中的当前位置。
abstract  voidwrite(int b)
          将单个字节写入到流中的当前位置。
 voidwriteBit(int bit)
          将单个位(由参数的最低有效位给定)写入到流的当前字节位置中的当前位偏移量。
 voidwriteBits(long bits, int numBits)
          将一个位序列(由 bits 参数的 numBits 个最低有效位按从左到右的顺序给定)写入到流的当前字节位置中的当前位偏移量。
 voidwriteBoolean(boolean v)
          将一个 boolean 值写入到流中。
 voidwriteByte(int v)
          将 v 的 8 个低位写入到流中。
 voidwriteBytes(String s)
          将一个字符串写入输出流。
 voidwriteChar(int v)
          此方法与 writeShort 同义。
 voidwriteChars(char[] c, int off, int len)
          将 char 序列写入到流中的当前位置。
 voidwriteChars(String s)
          将一个字符串写入输出流。
 voidwriteDouble(double v)
          将一个 double 值写入输出流,该值由四个字节组成。
 voidwriteDoubles(double[] d, int off, int len)
          将 double 序列写入到流中的当前位置。
 voidwriteFloat(float v)
          将一个 float 值(由四个字节组成)写入输出流。
 voidwriteFloats(float[] f, int off, int len)
          将 float 序列写入到流中的当前位置。
 voidwriteInt(int v)
          将 v 的 32 个位写入到流中。
 voidwriteInts(int[] i, int off, int len)
          将 int 序列写入到流中的当前位置。
 voidwriteLong(long v)
          将 v 的 64 个位写入到流中。
 voidwriteLongs(long[] l, int off, int len)
          将 long 序列写入到流中的当前位置。
 voidwriteShort(int v)
          将 v 的 16 个低位写入到流中。
 voidwriteShorts(short[] s, int off, int len)
          将 short 序列写入到流中的当前位置。
 voidwriteUTF(String s)
          将表示长度信息的两个字节按网络字节顺序写入输出流,后跟字符串 s 中每个字符的 UTF-8 修改版表示形式。
 
从类 javax.imageio.stream.ImageInputStreamImpl 继承的方法
checkClosed, close, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, length, mark, read, read, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
 
从类 java.lang.Object 继承的方法
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
从接口 javax.imageio.stream.ImageOutputStream 继承的方法
flushBefore
 
从接口 javax.imageio.stream.ImageInputStream 继承的方法
close, flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, length, mark, read, read, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
 

构造方法详细信息

ImageOutputStreamImpl

public ImageOutputStreamImpl()
构造一个 ImageOutputStreamImpl

方法详细信息

write

public abstract void write(int b)
                    throws IOException
从接口 ImageOutputStream 复制的描述
将单个字节写入到流中的当前位置。b 的 24 个高位将被忽略。

如果流中的位偏移量不为零,则首先将当前字节的余项用 0 填充并将其写出。写出后位偏移量将为 0。实现方可使用 ImageOutputStreamImplflushBits 方法来保证这一点。

指定者:
接口 DataOutput 中的 write
指定者:
接口 ImageOutputStream 中的 write
参数:
b - 一个 int,其低 8 位将被写入。
抛出:
IOException - 如果发生 I/O 错误。

write

public void write(byte[] b)
           throws IOException
从接口 ImageOutputStream 复制的描述
将字节序列写入到流中的当前位置。如果 b.length 为 0,则不写入任何字节。首先写入字节 b[0],然后写入字节 b[1],依此类推。

如果流中的位偏移量不为零,则首先将当前字节的余项用 0 填充并将其写出。写出后位偏移量将为 0。

指定者:
接口 DataOutput 中的 write
指定者:
接口 ImageOutputStream 中的 write
参数:
b - 要写入的 byte 数组。
抛出:
IOException - 如果发生 I/O 错误。

write

public abstract void write(byte[] b,
                           int off,
                           int len)
                    throws IOException
从接口 ImageOutputStream 复制的描述
将字节序列写入到流中的当前位置。如果 len 为 0,则不写入任何字节。首先写入字节 b[off],然后写入字节 b[off + 1],依此类推。

如果流中的位偏移量不为零,则首先将当前字节的余项用 0 填充并将其写出。写出后位偏移量将为 0。实现方可使用 ImageOutputStreamImplflushBits 方法来保证这一点。

指定者:
接口 DataOutput 中的 write
指定者:
接口 ImageOutputStream 中的 write
参数:
b - 要写入的 byte 数组。
off - 数据中的初始偏移量。
len - 要写入的 byte 数。
抛出:
IOException - 如果发生 I/O 错误。

writeBoolean

public void writeBoolean(boolean v)
                  throws IOException
从接口 ImageOutputStream 复制的描述
将一个 boolean 值写入到流中。如果 v 为 true,则写入值 (byte)1;如果 v 为 false,则写入值 (byte)0

如果流中的位偏移量不为零,则首先将当前字节的余项用 0 填充并将其写出。写出后位偏移量将为 0。

指定者:
接口 DataOutput 中的 writeBoolean
指定者:
接口 ImageOutputStream 中的 writeBoolean
参数:
v - 要写入的 boolean 值。
抛出:
IOException - 如果发生 I/O 错误。

writeByte

public void writeByte(int v)
               throws IOException
从接口 ImageOutputStream 复制的描述
v 的 8 个低位写入到流中。忽略 v 的 24 个高位。(这意味着 writeByte 的作用与使用整数做参数的 write 完全相同。)

如果流中的位偏移量不为零,则首先将当前字节的余项用 0 填充并将其写出。写出后位偏移量将为 0。

指定者:
接口 DataOutput 中的 writeByte
指定者:
接口 ImageOutputStream 中的 writeByte
参数:
v - 一个 int,包含要写入的 byte 值。
抛出:
IOException - 如果发生 I/O 错误。

writeShort

public void writeShort(int v)
                throws IOException
从接口 ImageOutputStream 复制的描述
v 的 16 个低位写入到流中。忽略 v 的 16 个高位。如果流使用网络字节顺序,则写入的字节将依次为:
(byte)((v >> 8) & 0xff)
 (byte)(v & 0xff)
 
否则,写入的字节将为:
 (byte)(v & 0xff)
(byte)((v >> 8) & 0xff)
 

如果流中的位偏移量不为零,则首先将当前字节的余项用 0 填充并将其写出。写出后位偏移量将为 0。

指定者:
接口 DataOutput 中的 writeShort
指定者:
接口 ImageOutputStream 中的 writeShort
参数:
v - 一个 int,包含要写入的 short 值。
抛出:
IOException - 如果发生 I/O 错误。