• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
From String to NSImage via JavaBridge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: is there a problem with the dec 2002 updater
  • Next by Date: Re: Drag image questions
  • Previous by thread: Re: is there a problem with the dec 2002 updater
  • Next by thread: refreshing the table of content
  • Index(es):
    • Date
    • Thread