3

The only way I know is to write a temp file, and read this file to create RandomAccessFile ,check it here

or use Use Unified I/O library (http://uio.imagero.com) here

Would this be the best way? Or can use temp file and the imageio library to implement it?

stacker
  • 68,052
  • 28
  • 140
  • 210
Koerr
  • 15,215
  • 28
  • 78
  • 108

1 Answers1

2

Yes, for random access of an InputStream you must buffer the stream (at least up to the point requested). A library like Unified I/O should work, or you can implement DataInput and DataOutput, which will have your class operating like a RandomAccessFile except for the file part if you have custom buffering needs.

Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101