简体   繁体   中英

how to create RandomAccessFile from InputStream?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM