This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Reading files in the memory" Watch "Reading files in the memory" New topic
Author

Reading files in the memory

Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
Hi!
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?

THanks


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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
Lorenz Baylon
Ranch Hand

Joined: Jan 04, 2006
Posts: 99
thanks jesper, i'll take a look at that
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Reading files in the memory
 
Similar Threads
Problem with using getResourceAsStream
Accessing hashmaps directly from disk instead of memory
Changing a String to an InputStream()
difficulty storing BufferedImage in Oracle BLOB field
save inf to resource file