From String to NSImage via JavaBridge
From String to NSImage via JavaBridge
- Subject: From String to NSImage via JavaBridge
- From: Ivan Myrvold <email@hidden>
- Date: Tue, 9 Sep 2003 15:39:04 +0200
I am using the JavaBridge to fetch data from an Oracle database, stored
as BLOB fields. Because the JavaBridge can not support the byte[] to
cross the JavaBridge, i am using String to send it to an NSString
instance on the Objective-C side.
On the Java side:
...
byte[] returndata = baos.toByteArray(); // baos is of type
ByteArrayOutputStream
str = new String(returndata);
return str;
On the Objective-C side:
...
id theblob = [rs getBlob:x]; // rs is of type ResultSet (Java side)
NSString *picstr = [[sqlconnection javaobject] selectBLOB:theblob]; //
the javaobject sends an sql command to select the picture, stores it in
picstr
So far, everything is fine. Now, I want to make an NSImage instance,
using the data stored in picstr. As this is an NSString, I can not use
the NSImage method initWithData: . I tried to store the NSString data
in file using the writeToFile:atomically: and create an NSImage using
the method initWithContentsOfFile:, and that worked fine, but there
should be a better method to do this?
Ivan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.