aspose file tools*
The moose likes I/O and Streams and the fly likes Reading an Image from Local drive and store to ByteArray 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 an Image from Local drive and store to ByteArray" Watch "Reading an Image from Local drive and store to ByteArray" New topic
Author

Reading an Image from Local drive and store to ByteArray

pavan aryan
Greenhorn

Joined: Feb 28, 2010
Posts: 15
I am working on a WebService that returns a Image from Server to Client. I followed different examples, and built a service that will reads a file from a URL and writes to a Byte Array.



Now i am looking for a way to read a file from local drive to ByteArray..i tried URL("c:\newimage.png") its not working..tried many ways from File to FileInputStream and BufferedInputStream to convert to bye array..nothing is working. Rest of code works only on ByteArray..i have to figure out a way to store an image from local directory to ByteArray....Please help Friends.

Thanks,
Kumar.


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41528
    
  53
Please read and follow ItDoesntWorkIsUseless and TellTheDetails.


Ping & DNS - my free Android networking tools app
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
If it's local, why URL ?

Check out File, InputStream and FileInputStream.


JDBCSupport - An easy to use, light-weight JDBC framework -
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading an Image from Local drive and store to ByteArray