站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v6.0, Java 2 SDK 英文文档

Java Image I/O API Guide: 4 - Writing Image I/O Plug-ins - JDK 5 Documentation v6.0, Java 2 SDK 英文文档

CONTENTS | PREV | NEXT JavaTM Image I/O API Guide


4.6 Writing Stream Plug-ins

The standard classes in the javax.imageio.stream package are able to create ImageInputStreams and ImageOutputStreams that:

  • Read from a File
  • Read from an InputStream, using a temporary File as a cache
  • Read from an InputStream, using a byte array in memory as a cache
  • Write to a File
  • Write to an OutputStream, using a temporary File as a cache
  • Write to an OutputStream, using a byte array in memory as a cache
It is possible to write new implementations of ImageInputStream and InmageOutputStream that interface with other I/O primitives (for example, databases or future fast I/O interfaces). The ImageInputStreamImpl and ImageOutputStreamImpl classes provide a base for subclassing. Only a handful of methods are required to be implemented by the subclass, although it is possible to implement more for greater efficiency:

  • int read()
  • int read(byte[] b, int off, int len)
  • write(int b)
  • write(byte[] b, int off, int len)
  • seek(long pos)



CONTENTS | PREV | NEXT
Copyright © 2001 Sun Microsystems, Inc. All Rights Reserved.