Transfer a Jpeg From Delphi to Java via JNI?

Hi Guys,
I am currently working on a project in which I have Windows DLL code that takes a screen capture (I'm using Delphi to write this). The result of this capture is stored as a TJpegImage. I have my Delphi code hooked to Java code (which the main program is written in) via JNI. I am trynig to transfer the Jpeg in a format in which Java can easily take it and make a BufferedImage out of it. How can I go about this? I have a few ideas, but I want to do it in the most efficient way possible. If someone knows how to do this, can they please share the solution with me?
Thanks,
-Tony

whome0,
Yes, thanks, that's exactly what I've been using. Basically, I'm at the point now where I know how to transfer the bytes, but for some reason, when I do this on the Java end:
ByteArrayInputStream input = new ByteArrayInputStream( byteArr );
JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder( input );
BufferedImage bi = decoder.decodeAsBufferedImage();
I get this error:
com.sun.image.codec.jpeg.ImageFormatException: Not a JPEG file: starts with 0x60 0x23
at sun.awt.image.codec.JPEGImageDecoderImpl.readJPEGStream(Native Method)
at sun.awt.image.codec.JPEGImageDecoderImpl.decodeAsBufferedImage(Unknown Source)
at com.sun.media.protocol.screen.LiveStream.read(LiveStream.java:166)
at com.sun.media.parser.RawBufferParser$FrameTrack.transferData(RawBufferParser.java:725)
at com.sun.media.protocol.screen.LiveStream.run(LiveStream.java:235)
at java.lang.Thread.run(Unknown Source)
I am baffled at this point, because I do a byte count before I send from my Delphi code, and a byte count on the Java receiving end, and they are identical. Looking at other JPGs I have on my hard drive, they begin in the same manner that this file does. So I'm not sure what's going on here.
-Tony

Similar Messages

  • How can i pass string from C++ DLL to Java via JNI?

    Hi everybody. I made a DLL with Borland C++. I must pass a string from this dll to Java via JNI.Namely i define a string variable in C++ DLL and i send this variable's value to Java via JNI.
    I can pass integers but i couldnt Strings. . How can i do this? is there any sample?

    Hi,
    So your function should be private static native String get_text();
    (It's often a good idea to make native methods private since when you change signatures you generally have to change java wrapper methods only).
    I know nothing about C++ strings but I'm pretty sure that you can convert it to char*, so
    do :
    char* szMyString = myString.toChar*();
    Then return from native with JNU_NewStringPlatform(env, szMyString)
    (see my 1st answer for JNU_NewStringPlatform() description).
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Unable to transfer photos (jpeg) from desktop to SD card.  Appears as if successful then does not show up when put SD card in camera.

    Unable to transfer photos (jpeg) from desktop to SD card for Cannon Power shot camera. 
    Appears as if successful, jpegs show up in SD card window,  but they do not  show up when I put SD card in camera.
    Go through entire process to no avail.  SD card is not locked.
    Thank You
    L

    Ahh, extra info ahead...
    Pictures on SD card, SanDisc-SDHC, 4GB Card, are jpeg.  The ones I would like to put on the card are jpeg as well.
    SD format MS-DOS (FAT32) .
    3.876 GB available on card.
    I have
    Exported the pics from iPhoto to the desktop. Inserted sd card into side of iMac.  The icon of card popped up.
    Attempts to no avail:
    1)   Dragged the photos to the disk icon for the sd card.
    2)   Dragged pictures into the DCIM folder (where all photos taken on camera resided).
    3)   Created new folder.  Put photos from desktop into folder and dragged ne folder inside DCIM -since pictures taken at different times had their own folders inside the DCIM folder.
    Every time the photos/files end up showing up on the sd card as long as it is in my computer but when ejected and inserted into my camera, all imported photos/jpeg file are gone.
    Hmmmmm

  • Transfer of photos from ipod to ipad via bluetooth, help

    transfer of photos from ipod to ipad via bluetooth, help

    The blluetooth isn't meant to do that. It's largely meant for headphones and keyboards.
    now, if you have the camera connection kit  you can attach your iPod to your iPad using that (plugging the iPod's charging cable to the USB part of the CCK) and the photos will transfer. I've done it with my Touch.

  • How to transfer garageband files from mac to ipad2 via internet?

    how to transfer garageband files from mac to ipad2 via internet?

    I'm asking this question 'cause we do music over internet and I need to send these files to my mate via internet to his ipad2..Didnt know that it doesnt work..Is there any other solution for that?..Thanx for answer anyway..

  • HT204387 Does anyone know how to transfer a contact from an iPhone 5 via bluetooth to a car stereo?

    Does anyone know how to transfer a contact from an iPhone 5 via bluetooth to a car stereo?

    Your stereo must support PBAP(Phone Book Access Profile).

  • Known problems or limits regarding accessing BDB with Java via JNI

    Hi,
    we are currently in an evalutation phase and are planning to use BDB (C|JE) as back-end for a queueing system. This system is written in Java. One key requirement is high availability of the data hold in the back-end. We need the guarantee, that no data is lost, e.g. data added after checkpoints. The throughput is expected to be quite high (> 10.000.000 records hold within one single BDB-environment (we would use n parallel BDB-envs inside the service).
    So i'm wondering about using JE or DB... The former doesn't provide a replication system but is a 100%-pure Java implementation, the latter is written in C and accessed via JNI, which adds some overhead and maybe instability issues but comes with an integrated replication system. JE would require us to develop an in-application replication system or to use a DFS for HA or something like that.
    Are there any known issues regarding using DB with Java via JNI? Or any other hints?
    TIA,
    Dirk

    Silly me, I forgot to mention that a null return value means that an exception was thrown so you should get that and print the value (although I suspect it will be "class not found").

  • How to transfer JPG/JPEG from one SAP system to another?

    I am not sure this is something that is easily possible, if even possible, and can't find anything about it.
    Does anyone know how to transfer a picture (JPG/JPEG) from one SAP system to another (both 7.00+)? 
    Scenario would be something similar to uploading a photo into one SAP system, then having it pass it to a central SAP system.
    Any thoughts about how or if it is possible would be helpful.
    Thanks,
    Jake

    Hi,
    I can think about at least two ways. One way is using web services or RFC. You can create a RFC enabled FM which would return a string of bytes (type XSTRING) for some particular ID. It's pretty easy to expose RFC enabled FM as web service. Consuming web service from ABAP is easy as well. Another solution is using REST based interface. You would write a HTTP handler which would return a jpeg image for particular ID. For example URL would look like http://<hostname>/image/?id=ABC and client would just call GET request for this URL and response would contain jpeg image.
    Cheers

  • Transfer pics **DIRECTLY** from Canon camera(SDcard) via**WIRE** to iPhone3G?

    Is there a way to transfer pics  **DIRECTLY**  ie, **NO COMPUTER** from Canon camera(SDcard) via  **WIRE**ie., **NO WiFi**  to iPhone3G?
    Do you all understand my question?
    Please don't respond that I need a computer to do that...I know this.
    What I want is a "device" like a card reader, that will plug **DIRECTLY** into an iPhone...Thanks.
    Ness
    <Personal Information Edited by Host>

    The only way I could think of to do this would be by using the camera connection kit. One of the 2 pieces is a dock-USB connector so your could plug the camera directly into it, the other piece is a card reader that plugs into the dock connector. It's designed for the iPad. I haven't heard of anyone trying to use it on an iPhone. I'm sure someone has tried, but I have no idea what the result would have been.

  • We have one iPod and two iPhones; we have not been able to transfer our music from Ipod to IPhones, via iTunes, please assist?

    We have one iPod and two iPhones; we have been unable to transfer our music from the Ipod via iTunes to the iPhones, please assist.

    did you right click the ipod/iphone and click transfer purchases

  • How do I transfer photos sent from my friends iPhone via messages, to my Mac?

    How do I transfer photos sent from my friend's iphone via Messages, to my iMac?

    if ur using imessages then it should be on your mac imessages to...provided u are using the same apple id for both

  • How to get data from php to java via xmlrpc

    I have been trying to get data from php through apache xmlrpc to java.
    I do get an value as result. The result is "Array". How how do i convert the XMLRPC Object "Array" to Java Object?
    Inside the XMLRPC "Array" Object there is object too of type Array from php.
    See code for java here
    Object result = client.execute( "blogger.getCategories", params1 );
    Code from php here
    function getCategories($appkey, $username, $password)
         global $xmlrpcerruser, $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble, $xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64, $xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
         $structArray = array();
         $structArray[] = new xmlrpcval(array("one" => "test"));
         return new xmlrpcresp(new xmlrpcval( $structArray , $xmlrpcArray));     
    I do get Standard String and Integer from php to Java through XMLRPC.
    Can someone help me.
    Edited by: Electron32 on Aug 13, 2010 9:44 AM

    That is what is so strange. I return an 'array' through xmlrpcval() and in Java I tried to cast it to ArrayList, Vector,String[] but get an error
    Object[] result = (Object[]) client.execute( "blogger.getCategories", params1 );
    String[] array = (String[]) result;
    Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
            at com.dirdalit.window.Main.main(Main.java:41)
    Edited by: Electron32 on Aug 13, 2010 12:25 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • I am new to iphone., want to transfer some files from my LG  KM900 via bluetooth, having trouble pairing, is it possible

    Hi there,
    New to the iphone, and love it, but I would like to send a couple of files and photos to it from my previous phone via bluetooth... My previous phone was an LG KM900 and im having difficulty pairing with it... saying its not supported.,
    Can someone give me a list of compatible bluetooth(able) phones, and i will do it through a third party...
    Many thanks and I do hope there is a way to do this
    regards
    Debz

    This is not a feature of the iphone or iOS.
    Bluetooth is supported for stereo headsets/speakers, handsfree telephone
    devices/headsets, some keyboards, some peer-to-peer apps from the app
    store and internet tethering where provided by the carrier.
    Other than this it will not connect to a phone/computer/device.  (thanks to ckuan for the wording)
    You could try emailing the files/photos from the LG and then open the emails
    on the iPhone. Depending on the type of file, the iPhone should be able to at
    least view the contents - editing will require an app capable of dealing with that
    particular type of file. Photos should be viewable unless in proprietary format.

  • Pass an ArrayList of objects from C++ to JAVA using JNI

    Hello,
    I need to get the running Windows processes using C++ and have a Process struct in C++ having 2 fields: name and pid. I want to pass an ArrayList of Process from C++ to Java. I have found an example of how to pass an array of objects from C++ to Java, but I'd like to pass an ArrayList, and I was wondering if this is possible, before understanding that example and use an array.
    I don't have much experience with C++ and I don't even know if you have something like an ArrayList in C++, so I'm sorry if it doesn't make any sense what I'm talking about. Thank you.

    From C you can access and/or imnstantiate one of the
    java collections. In other words, your C code should
    simply populate java structures and a collection.I have read this is possible after I posted this, but didn't find an example yet. I began reading "Java Native Interface" book from Addison-Wesley today to get a better understanding of JNI.
    If you know where to find an example of doing this, I would appreciate it. Otherwise, I suppose I will find this in the above mentioned book quite soon... Thank you.

  • Pass an array of integers from C to Java with JNI

    Hello,
    I have a C function that returns a struct me. The fields of this struct are all of type integer. I, with the fields of this structure create an array of integers in C language I would like to pass this array of integers c, in Java using JNI.
    How can I make this?

    I don't see how you compiled that.
    It certainly will not compile for me.
    jintArray position=(jintArray)(*env)->NewIntArray(env,2);That is the invocation idiom for C code.
    jint f[2];You cannot have a variable declaration in the middle of a method (block) in C code. That is only allowed in C++.
    C code and C++ code is not the same.
    The following is C++ code. Note that it does NOT include getBinaryPoint() since that method could be the source of the problem.
    jintArray position = env->NewIntArray(2);
    if(position==NULL)     return NULL;
    jint f[2];
    f[0]=3;
    f[1]=4;
    env->SetIntArrayRegion(position,0,2,f);
    return position;

Maybe you are looking for

  • How do I add a email to my iMessage so that I can have two emails

    How do I add a email to my iMessage so that I can have two emails

  • I tried to update iTunes and it wouldn't let me install it

    iTunes wanted me to update it (it was working fine before) and I downloaded it and it gave me an error message and wouldn't let me start iTunes up. It said I could retry so I redownloaded iTunes from apple.com and tried over and over again but it did

  • Aperture 3 CPU Activity

    This is actually part 2 of a post I had about Aperture 3 crashing even after I tried every fix suggested by Apple and everyone else. I have been watching my CPU usage when I am using Aperture 3. I notice that any editing causes the CPU usage to go fr

  • More than one tree in a VBox

    I have one VBox and I load a tree there. To load the tree I get a String with the xml structure. But now I want to load another tree below the first tree, but if it is the same tree I only want to refresh, not load below the same tree. Something like

  • Migration Error in Oracle..

    Using oracle 10g SQL 2005 Oracle SQL Developer version 1.2.1 Oracle IDE 1.2.1.3213 Created an offline migration capture script. Ran it against a database with out any errors. When I load the script in oracle sql dev. I get an error oracle.dbtools.met