File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes retrieve a file from a fileinputstream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "retrieve a file from a fileinputstream" Watch "retrieve a file from a fileinputstream" New topic
Author

retrieve a file from a fileinputstream

Gaurav Chikara
Ranch Hand

Joined: Jun 09, 2000
Posts: 410
Is there any way to retrieve a file from a fileinputstream
:roll:


SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Not that I see, but you can get the FileChannel from the stream, find the size of the file, and construct a new one from the data.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Depends what you mean by "retrieve the file". You can certainly read the contents of the file. But if you want to know the name and location of a file, there doesn't seem to be any way to do that. If you really need to find the file name, and have no other way to do this, I suppose you could read in the contents, and then search the file system for a file with the same contents. (Similar to using grep or find in Unix.) But this is pretty ugly. I'd strongly recommend a redesign of some sort so you don't have to do this.


"I'm not back." - Bill Harding, Twister
 
 
subject: retrieve a file from a fileinputstream
 
Similar Threads
File Not Found Path Problem in JSP
filename conversion
how to store an image into the DataBase using oracle database
byte or int array into BufferedImage
how to save files into oracle database using java as a object.