Re: Reading NSData from a file
Re: Reading NSData from a file
- Subject: Re: Reading NSData from a file
- From: Mike Schrag <email@hidden>
- Date: Tue, 3 Apr 2007 11:55:29 -0400
public static NSData nsDataFromFile( String filePath ) throws FileNotFoundException, IOException { File theFile = new File( filePath ); return new NSData( new FileInputStream( theFile ), (int)theFile.length() ); }
It doesn't appear that new NSData(InputStream, int) closes the stream ... Curiously, new NSData(file) DOES, but that's deprecated.
You may want to make this:
File theFile = new File(filePath); FileInputStream theFileStream = new FileInputStream(theFile); try { return new NSData(theFileStream, (int)theFile.length()); } finally { theFileStream.close(); }
ms |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden