473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to read the byte arry data?

Hi,

I have invoking the "NewDll.Dll" which created using vc++. In this Dll a method return the array data following way,

BYTE NewDemoDll::RetLiveImg()
{
return bufferData[ImageSize];
}

How can I write the code in Java to get the data from the above method?

Please help me to solve this problem.
Sep 3 '07 #1
2 2160
r035198x
13,262 8TB
Hi,

I have invoking the "NewDll.Dll" which created using vc++. In this Dll a method return the array data following way,

BYTE NewDemoDll::RetLiveImg()
{
return bufferData[ImageSize];
}

How can I write the code in Java to get the data from the above method?

Please help me to solve this problem.
Try JNI
Sep 3 '07 #2
Try JNI

Thanks for your reply.

I already tried to JNI wrapper. Here I given that code,

*****************************WRAPPER************** **************************
class ImageWrapper
{
Library library =null;
Function function =null;

PowerShot(String libname)
{
library = new Library(libname);
library.load();

}


public PrimitiveArray RetLiveImg(String fn_name)
{
function=library.getFunction(fn_name);
PrimitiveArray data = new PrimitiveArray(UInt8.class, 20480);
function.invoke(data);
return data;
}


public static void main(String args[])throws IOException
{

ImageWrapper wrap=new ImageWrapper("newdll");

function="?RetLiveImg@NewDemoDll@NewDll@@SAEXZ";

PrimitiveArray array=sdk.RetLiveImg(function);

byte[] buffer= array.getBytes();
FileOutputStream out=new FileOutputStream("liveimage.jpg");
out.write(buffer);
out.close();


}
}

When I compile above program, I got the following error,

*********************************ERROR ***************************************

D:>java ImageWrapper

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d316eb0, pid=1416, tid=2440
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_12-b04 mixed mode, sharing)
# Problematic frame:
# C [java.dll+0x6eb0]
#
# An error report file with more information is saved as hs_err_pid1416.log


Shall you give a example to read the Binary Data from DLL?
Sep 3 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Gavin | last post by:
Hi, I'm a newbie to programming of any kind. I have posted this to other groups in a hope to get a response from anyone. Can any one tell me how to make my VB program read the Bios serial number...
19
by: ranjeet | last post by:
Hay Guys can you all suggest me the points on the below issue Problem : The thing is that I have the data some thing like this. 1486, 2168, 3751, 9074, 12134, 13944, 17983, 19173, 21190,...
5
by: Pete | last post by:
I having a problem reading all characters from a file. What I'm trying to do is open a file with "for now" a 32bit hex value 0x8FB4902F which I want to && with a mask 0xFF000000 then >> right...
5
by: kevinniu | last post by:
Hi everyone, In c#, what is the fastest way(include unsafe) to convert a array of bytes(which really contains the bytes of a double array) to a arry of double. thanks
9
by: tawright915 | last post by:
I want to convert a byte array to a string or text to write it out in a multiline textbox. I've tried encoding, and converting but end up with nothing in the textbox. The strange thing is that...
0
by: lovecarole | last post by:
hi, i am the student who should write a program about reading wav file and do the DFT. actually i don't know how to read data of the wav song and save it into the array... if i want to read...
1
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I have probelm that I hung with for three weeks, My problem is I want to read Binary data from database. I will told you what I did : first I declear an array byte and I cast the...
5
by: dm3281 | last post by:
Hello, I have a text report from a mainframe that I need to parse. The report has about a 2580 byte header that contains binary information (garbage for the most part); although there are a...
3
by: sam | last post by:
same as subject?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.