jQuery in Action, 3rd edition
The moose likes I/O and Streams and the fly likes Reading files in the memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Reading files in the memory" Watch "Reading files in the memory" New topic

Reading files in the memory

Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
I am writing a code that will get image properties such as length and width in inches from a particular file. I was able to do it however my method does this by reading a physical file through InputStream.

My problem is that i have the file in the memory, but then i have to write in in file using the ImageIO.write method to fit the method that accepts InputStream as parameter. Is there a java api that reads a file that is in memory?


I just cant look, its killing me.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

Have a look at the API documentation of BytaArrayInputStream. It reads from a byte[] instead of from a file.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
thanks jesper, i'll take a look at that
I agree. Here's the link: http://aspose.com/file-tools
subject: Reading files in the memory
It's not a secret anymore!