
Signature
Dag.
Listen to your brain - it has a lot of information.
(Chelsey, 7) -
> Will for example the statement:
> "env->SetByteArrayRegion(jb,0,14, (jbyte *)'A');"
> fill the jbyteArray with 15 'A' characters?
No.
SetByteArrayRegion() takes a start and length, so the length of the
region to fill is 14, not 15.
Also, 'A' is a char, not an array. Attempting to treat it as a pointer
is most likely the cause of your crash. You probably meant "A", which
is an array of two characters ('A' followed by a terminating 0) and
can be passed as a pointer.
However, the array you pass to SetByteArrayRegion() needs as many
elements as the number you specified, i.e. 14. So you'd need to pass
"AAAAAAAAAAAAAA" for this to work as you intend. You might consider
creating the native "AAA" buffer programmatically, or using
SetByteArrayElement() to set the elements one at a time in a loop.
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Dag Sunde - 04 Jan 2007 17:54 GMT
>> Will for example the statement:
>> "env->SetByteArrayRegion(jb,0,14, (jbyte *)'A');"
[quoted text clipped - 15 lines]
> creating the native "AAA" buffer programmatically, or using
> SetByteArrayElement() to set the elements one at a time in a loop.
Gordon!
You're a genius!
Setting "AAAAAAAAAAAAAA" worked perfectly. But I can't find any
method named SetByteArrayElement(), so I wasn't able to test that loop.
On the other hand, I just needed to return something in a bytearray
to get this skeleton up and running. The byte array will eventually
be filled with jpeg data from a Canon PowerShot camera.
You have my eternal gratitude (well... for a long time, anyway)!
:-)

Signature
Dag.
Listen to your brain - it has a lot of information.
(Chelsey, 7) -
Gordon Beaton - 04 Jan 2007 18:35 GMT
> But I can't find any method named SetByteArrayElement(), so I wasn't
> able to test that loop.
My bad, I was thinking of SetObjectArrayElement() (which doesn't apply
here).
Another suggestion is to use GetByteArrayElements() to get a native
array from the byte array, make any changes to the native
array, then use ReleaseByteArrayElements() with JNI_COMMIT in order to
propagate your changes back to the Java array.
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Gordon Beaton - 04 Jan 2007 20:18 GMT
> The byte array will eventually be filled with jpeg data from a Canon
> PowerShot camera.
BTW are you aware of libgphoto? Apparently there are Java bindings.
Base your application on that (except on Windows) and you'll be able
to support hundreds of different cameras: http://www.gphoto.org/ .
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Dag Sunde - 05 Jan 2007 21:42 GMT
>> The byte array will eventually be filled with jpeg data from a Canon
>> PowerShot camera.
>
> BTW are you aware of libgphoto? Apparently there are Java bindings.
> Base your application on that (except on Windows) and you'll be able
> to support hundreds of different cameras: http://www.gphoto.org/ .
Now, *That* is interesting!
I convinced the customer to use Win2000 for the time being,
because the selected camera and printer vendors have absolutely
*no* support for U*ix, whatsoever. The customer really want this to run
under Fedora core4/5 or Debian because of stability.
Do you know if libgphoto have support for Remote Capture for
the "Canon Powershot A640" camera?
And have your ever heard of any Linux drivers for a
"Mitsubishi 9559" printer too?
:-)

Signature
Dag.
Dag Sunde - 05 Jan 2007 21:45 GMT
>>> The byte array will eventually be filled with jpeg data from a Canon
>>> PowerShot camera.
[quoted text clipped - 16 lines]
> "Mitsubishi 9559" printer too?
> :-)
A little bit triggerhappy there...
I checked myself, and found that libgphoto2 2.3.0 have
A640 support, but it isn't clear if it support the remote
capture feature...

Signature
Dag.