Reputation: 15723
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?
Upvotes: 3
Views: 4094
Reputation: 18333
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.
Upvotes: 2