| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.imageio.stream.ImageInputStreamImpl
javax.imageio.stream.ImageOutputStreamImpl
javax.imageio.stream.FileCacheImageOutputStream
public class FileCacheImageOutputStream
      将输出写入常规 OutputStream 中的 ImageOutputStream 的实现。在将数据刷新到输出流前用于缓存数据的文件。 
| 字段摘要 | 
|---|
| 从类 javax.imageio.stream.ImageInputStreamImpl 继承的字段 | 
|---|
| bitOffset, byteOrder, flushedPos, streamPos | 
| 构造方法摘要 | |
|---|---|
| FileCacheImageOutputStream(OutputStream stream, File cacheDir)构造一个将向给定 outputStream进行写入的FileCacheImageOutputStream。 | |
| 方法摘要 | |
|---|---|
|  void | close()关闭此 FileCacheImageOututStream。 | 
|  void | flushBefore(long pos)丢弃所指示位置之前的流初始部分。 | 
|  boolean | isCached()返回 true,因为此ImageOutputStream为了允许逆向查找而缓存了数据。 | 
|  boolean | isCachedFile()返回 true,因为此ImageOutputStream维护文件缓存。 | 
|  boolean | isCachedMemory()返回 false,因为此ImageOutputStream不维护主存缓存。 | 
|  long | length()返回 -1L,指示流的长度未知。 | 
|  int | read()从流中读取单个字节,并以 int(0 到 255 之间)形式返回该字节。 | 
|  int | read(byte[] b, int off, int len)从流中读取至多 len个字节,并将其存储到b中(从off索引处开始)。 | 
|  void | seek(long pos)设置当前流位置并将位偏移量重置为 0。 | 
|  void | write(byte[] b, int off, int len)将字节序列写入到流中的当前位置。 | 
|  void | write(int b)将单个字节写入到流中的当前位置。 | 
| 从类 javax.imageio.stream.ImageOutputStreamImpl 继承的方法 | 
|---|
| flushBits, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeLong, writeLongs, writeShort, writeShorts, writeUTF | 
| 从类 javax.imageio.stream.ImageInputStreamImpl 继承的方法 | 
|---|
| checkClosed, finalize, flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, mark, 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, setBitOffset, setByteOrder, skipBytes, skipBytes | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 从接口 javax.imageio.stream.ImageInputStream 继承的方法 | 
|---|
| flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, mark, 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, setBitOffset, setByteOrder, skipBytes, skipBytes | 
| 构造方法详细信息 | 
|---|
public FileCacheImageOutputStream(OutputStream stream,
                                  File cacheDir)
                           throws IOException 
  outputStream 进行写入的 
    FileCacheImageOutputStream。 
     将临时文件用作缓存。如果 cacheDir 不为 null 且是一个目录,则在该处创建文件。如果为 null,则将使用与系统相关的默认临时文件目录(有关详细资料,请参阅 File.createTempFile 的文档)。 
stream - 将写入到的 
      OutputStream。
     cacheDir - 一个指示缓存文件创建目录的 
      File;或 
      null,指示使用系统目录。 
     IllegalArgumentException - 如果 
      stream 为 
      null。 
     IllegalArgumentException - 如果 
      cacheDir 不为 
      null 但不是一个目录。 
     IOException - 如果无法创建缓存文件。
     | 方法详细信息 | 
|---|
public int read()
         throws IOException 
  ImageInputStreamImpl 复制的描述
   int(0 到 255 之间)形式返回该字节。 如果到达 EOF,则返回 
    -1。 
    子类必须提供此方法的实现。子类实现在退出前应该更新流位置。
在发生读取前,流中的位偏移量必须被重置为 0。
ImageInputStream 中的 
      read
     ImageInputStreamImpl 中的 
      read
     -1。 
     IOException - 如果流已经被关闭。
     
public int read(byte[] b,
                int off,
                int len)
         throws IOException 
  ImageInputStreamImpl 复制的描述
   len 个字节,并将其存储到 
    b 中(从 
    off 索引处开始)。如果由于到达流末尾而没有读取任何字节,则返回 
    -1。 
    在发生读取前,流中的位偏移量必须被重置为 0。
子类必须提供此方法的实现。子类实现在退出前应该更新流位置。
ImageInputStream 中的 
      read
     ImageInputStreamImpl 中的 
      read
     b - 用来接收写入的字节数组。
     off - 
      b 中要写入的起始位置。
     len - 要读取的最大字节数。 
     -1,指示 EOF。 
     IOException - 如果发生 I/O 错误。
     
public void write(int b)
           throws IOException 
  ImageOutputStream 复制的描述
   b 的 24 个高位将被忽略。 
     如果流中的位偏移量不为零,则首先将当前字节的余项用 0 填充并将其写出。写出后位偏移量将为 0。实现方可使用 ImageOutputStreamImplflushBits
DataOutput 中的 
      write
     ImageOutputStream 中的 
      write
     ImageOutputStreamImpl 中的 
      write
     b - 一个 
      int,其低 8 位将被写入。 
     IOException - 如果发生 I/O 错误。
     
public 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
     ImageOutputStreamImpl 中的 
      write
     b - 要写入的 
      byte 数组。
     off - 数据中的初始偏移量。
     len - 要写入的 
      byte 数。 
     IOException - 如果发生 I/O 错误。
     public long length()
ImageInputStreamImpl 复制的描述
   -1L,指示流的长度未知。子类必须重写此方法来提供实际的长度信息。 
    
ImageInputStream 中的 
      length
     ImageInputStreamImpl 中的 
      length
     
public void seek(long pos)
          throws IOException 
  EOFException。在执行写入前,文件长度不会增加。 
    
ImageInputStream 中的 
      seek
     ImageInputStreamImpl 中的 
      seek
     pos - 一个 
      long,它包含所需的文件指针位置。 
     IndexOutOfBoundsException - 如果 
      pos 小于刷新的位置。 
     IOException - 如果发生任何其他 I/O 错误。
     public boolean isCached()
true,因为此 
    ImageOutputStream为了允许逆向查找而缓存了数据。 
    
ImageInputStream 中的 
      isCached
     ImageInputStreamImpl 中的 
      isCached
     true。
     isCachedMemory(), 
      isCachedFile()
     public boolean isCachedFile()
true,因为此 
    ImageOutputStream 维护文件缓存。 
    
ImageInputStream 中的 
      isCachedFile
     ImageInputStreamImpl 中的 
      isCachedFile
     true。
     isCached(), 
      isCachedMemory()
     public boolean isCachedMemory()
false,因为此 
    ImageOutputStream 不维护主存缓存。 
    
ImageInputStream 中的 
      isCachedMemory
     ImageInputStreamImpl 中的 
      isCachedMemory
     false。
     isCached(), 
      isCachedFile()
     
public void close()
           throws IOException 
  FileCacheImageOututStream。所有的挂起数据都将被刷新到输出,关闭并移除该缓存。但不关闭目标 
    OutputStream。 
    
ImageInputStream 中的 
      close
     ImageInputStreamImpl 中的 
      close
     IOException - if an error occurs.
     
public void flushBefore(long pos)
                 throws IOException 
  ImageInputStream 复制的描述
   IndexOutOfBoundsException。 
     调用 flushBefore 可允许实现此接口的类释放存储流中的数据所使用的资源,如内存和磁盘空间。 
ImageInputStream 中的 
      flushBefore
     ImageOutputStream 中的 
      flushBefore
     ImageInputStreamImpl 中的 
      flushBefore
     pos - 一个 
      long,它包含要刷新的流前缀的长度。 
     IOException - 如果发生 I/O 错误。
     | 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。