How to get bytes[] using jni functions
I am new to JNI and have a question. I have a java class which returns back bytes[]
I have the class jclass for the object and the jmethodid bytesMethodID which is mapped like this:
bytesMethodID = (*env)->GetMethodID(env, objcls, "bytes", "()[B");
now in the c impementation I have a stuct pointer
DESIGN_STRUCT *str= NULL;
How do I assign the bytes[] into this struct pointer? If I do the following:
str = (*env)->CallObjectMethod(env, obj, bytesMethod());
I get a "assignment from incompatible pointer type" if I change that to:
str = (*env)->CallBytesMethod(env, obj, bytesMethod());]
I get a "assignment makes pointer from integer without a cast"
My question is what JNI function do i use to get back a byte[]
Any help and pointers greatly appreciated.
Thanks,
You should use CallObjectMethod() and cast the return value to a jbyteArray. Then you need to use a function like GetByteArrayElements() to actually retrieve the individual elements in that array.
God bless,
-Toby Reyelts
Check out the free, open-source, JNI toolkit, Jace - http://jace.reyelts.com/jace.
Similar Messages
-
Hi out there. To capture a screen shot one uses: Command-Shift-3 or 4. I have done this for a long time. Now suddenly neither screen shot command works anymore. Suggestions how to get this useful function back? Thanks, Georgx
Command-Shift-3 and 4 works just fine on several Macs that I have here.
Try restarting your Mac....or post in the specific support area for your Mac model....for more advice.
https://discussions.apple.com/index.jspa -
In ABAP HR how to get job using position
In ABAP HR how to get job using position (Using Infotype 1001)
Hi anilkumar,
1. u have the position
u want the Job
2. In hrp1001 table
OTYPE = 'S' (for position)
OBJID = POSITION (AS ABOVE)
SCLAS = 'C' (for finding job)
<b> SOBID = XXXXXX (here u will get the JOB)</b>
regards,
amit m. -
How to get image using Http and how to save in Smulator
Hi guys,
Am working in black berry bold. i dont know how to get image using htp connection and one more thing i need to save this image in side simulator directory............. what are the specific API i should...
Guide me.........If you want the input image size you need to pass it in as parameters.
A discussion thread on this topic is:
http://forums.adobe.com/thread/29948
-- Daniel R. <[email protected]> http://danielr.neophi.com/ -
How to get BOOLEAN from STORED FUNCTION
We are calling legacy PLSQL stored procedures and functions via named queries. This has worked fine so far, but there are some functions which return the type 'BOOLEAN'. e.g.
FUNCTION some_function( some_argument IN NUMBER) RETURN BOOLEAN;
Where the return type is BOOLEAN calling the named query fails with
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 13:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
A couple of threads have hinted that what we are trying to do is not possible:
How to get BOOLEAN from STORED PROCEDURES
Re: Creating Named Query: from OracleCallableStatement
This would possibly be due to 'restriction in the OCI layer'. Can anyone help? Is there really now way to call a valid PLSQL stored function via a named query when the return type is BOOLEAN?
thanksI can't comment on possible issues you might have with the driver, but if it can be done in JDBC, it should be possible in TopLink.
TopLink has the StoredFunctionCall which extends the StoredProcedureCall but adds an unnamed ouput parameter in the first spot of its parameter list. You will need to get the databasefield and set its type to BOOLEAN ie:
DatabaseField returnField = (DatabaseField)yourStoredFunctionCall.getParameters().firstElement();
returnField.setName(name);
returnField.setSqlType(Type.BOOLEAN);Be sure not to use the setType() method, as I believe TopLink will try to use the Type.BIT when a boolean class is used as the classtype.
Best Regards,
Chris -
How to get subrc in this function module
CALL FUNCTION 'FI_PERIOD_CHECK'
EXPORTING
I_BUKRS = 'C553'
I_OPVAR = ' '
I_GJAHR = it_out-datains1+0(4)
I_KOART = 'S'
I_KONTO = 'zzzzzzzzzz'
I_MONAT = L_IODM
EXCEPTIONS
ERROR_PERIOD = 1
ERROR_PERIOD_ACC = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
when i am testing this function module i am getting error_period_acc =2.
but i used this one in program like above code i am getting subrc=0.
i have doubt in this one is we can comment exceptions or uncomment.
i want sy-subrc <> 0.
how can i getTry using this way
CALL FUNCTION 'FI_PERIOD_CHECK'
EXPORTING
i_bukrs = cashin_header-bukrs
i_gjahr = i_gjahr
i_koart = 'D'
i_monat = i_poper
EXCEPTIONS
error_period = 1
error_period_acc = 2
OTHERS = 3.
IF sy-subrc <> 0.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = return.
APPEND return.
ENDIF. -
How to get Multiple records from functions
Hi Everyone
Im new to this stuff. Im trying through JCO. As far as the single recordsets like data of customer or article are concerned i get it through an array.
But i wanted to retrieve
1- Whole tables like (all articles)
2- Selected articles. or Customer order details (articles in PO)
That means multiple records in one go.
Later on ill display it in JTables.
Like for the past three days i was googling around. Thought like this ones not for my stomach. Came across this Forum. Thought its worth posting a request.
Here is the code
public String[] KSearch(String Knr) throws Exception{
String[] Result=new String[11];
IFunctionTemplate ftemplate= Con.repository.getFunctionTemplate("SucheKUNDE");
if (ftemplate == null)
throw new Exception("Funktionstemplate nicht gefunden");
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList input = function.getImportParameterList();
input.setValue(Knr,"FieldName");
JCO.Client client = JCO.getClient(Con.conPoolId);
client.execute(function);
JCO.ParameterList output = function.getExportParameterList();
Result[0]=output.getString("NAME");
Result[1]=output.getString("VORNAME");
Result[2]=output.getString("GDATE");
Result[3]=output.getString("TELEFON");
Result[4]=output.getString("MAIL");
Result[5]=output.getString("STRASSE");
Result[6]=output.getString("PLZ");
Result[7]=output.getString("ORT");
Result[8]=output.getString("KONTO");
Result[9]=output.getString("INSTITUT");
Result[10]=output.getString("BLZ");
JCO.releaseClient(client);
return Result;
now instead of a single record what if im expecting a number of records, like what if i need customer over 25. Which means more than one. I have to get in tabular format so that i can display it in JTables.
Hope it a bit illustrative.
Regards
Edited by: Aaron Maleck on Jan 5, 2008 7:35 AMpublic String[] KSearch(String Knr) throws Exception{
String[] Result=new String11;
IFunctionTemplate ftemplate= Con.repository.getFunctionTemplate("SucheKUNDE");
if (ftemplate == null)
throw new Exception("Funktionstemplate nicht gefunden");
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList input = function.getImportParameterList();
input.setValue(Knr,"FieldName");
JCO.Client client = JCO.getClient(Con.conPoolId);
client.execute(function);
// Maybe here you should use a JCO.Table Class to get the //ExportParameters such as
JCO.Table output = function.getTableParameterList().getTable( "tabelname" );
// so you can use setRow() Function to get the information of the //relevant record. such as the 3. Costum
output.setRow(3);// Record Number
Result[0]=output.getString("NAME");
Result[1]=output.getString("VORNAME");
Result[2]=output.getString("GDATE");
Result[3]=output.getString("TELEFON");
Result[4]=output.getString("MAIL");
Result[5]=output.getString("STRASSE");
Result[6]=output.getString("PLZ");
Result[7]=output.getString("ORT");
Result[8]=output.getString("KONTO");
Result[9]=output.getString("INSTITUT");
Result10=output.getString("BLZ");
JCO.releaseClient(client);
return Result;
Iam not sure that works. But you can try it. and reply me to tell if it really works as i think.
Hope helps.
Amao -
Authentication syntax for HTTP GET method using TCP functions in Labview on linux
Hi,
Currently, I am trying to communicate to web server. I have Labview installed on a Linux machine. The HTTP function blocks and other labview functions do not work. Hence, I am building a HTTP code string using TCP functions (port 80) to talk to the web server. I am successfully able to fetch a response from web sites (example www.ni.com) from my vi. However, when I try to communicate to my web server, it does not work. It requires an authentication. I am able to open http://ipaddress in my browser from my machine using username and password. Can someone help with Authentication string requirement for GET method?
so far the string is:
GET /index/ HTTP/1.1
Host: http://xx.xx.xx.xxAn easy option would be to try http://userassword@server syntax for the URL.
Else I posted a Twitter fetcher once (won't work anymore since Twitter moved to Oauth authentication) at LAVA. Based on code from @cloew.
The code is part of this LLB.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be! -
How to get byte array from jpg in resource for Image XObject?
Hi,
Does anyone know how to get an array of bytes from a jpg from resource without an external library except MFC?
The array of bytes is needed to create an Image XObject so it can be included in an appearance for an annotation.Sounds like a standard Windows programming question, not specific to the SDK.
-
How to get the transaction by function out of VIRSA in an easy way
Hi collegues,
I'm looking for a simple solution / query to extract a list out of VIRSA compliance calibrator (5.2). The list should bring up the transaction codes by function.
e.g.
PM01 - ca87
PM01 - ip30
If possible please name the table in VIRSA where this information is stored so I can do a simple query in the SQL-view
thanks a lot
MatthiasHi Matthias,
in RAR 5.3 you can use the download function of the rule architect. There you get information about tables, functions, actions and permissions.
I don't know if you have this function in VIRSA compliance calibrator 5.2. I started my career with 5.3
Regards
Dirk -
How to filter group using in function
Hey
i am trying to do a group filter in the data model using IN function
g.segment3 in ('401000', '401010', '401020', '409100')
how can i configure the filter is in one of these values ?
i tried the
g.segment3 in ('401000', '401010', '401020', '409100') but its showing me an error
any reason why ?
thanksHey
i am trying to do a group filter in the data model using IN function
g.segment3 in ('401000', '401010', '401020', '409100')
how can i configure the filter is in one of these values ?
i tried the
g.segment3 in ('401000', '401010', '401020', '409100') but its showing me an error
any reason why ?
thanks -
Hi,
I have this xml file stored in operator.xml
<Operator>
<Customer>
<Name>sam</Name>
<Street>albert str.</Street>
<ZipCode>45454</ZipCode>
<City>NY</City>
<Country>USA</Country>
<EMailAddress>[email protected]</EMailAddress>
<MeterNumber>1000</MeterNumber>
<MeasuringUnit>kWh</MeasuringUnit>
<Reading>
<Month>1</Month>
<Value>900</Value>
</Reading>
<Reading>
<Month>2</Month>
<Value>725</Value>
</Reading>
<Reading>
<Month>3</Month>
<Value>950</Value>
</Reading>
</Customer>
</Operator>I have the following getter statements in my code:
String name=req.getName();
int month=req.getMonth();Now, I want to get value for particular customer (by checking name for equality with getter) and for particular month( by checking for equality with getter).
I have written the following statements:
final String filename="operator.xml";
SAXBuilder builder=new SAXBuilder(true);
Document doc=builder.build(filename);
Element root=doc.getRootElement();How to proceed further using JDOM. I am confused with getChild(), getChildText() etc.,
thanks,Obtain values with the JDom XPath class selectSingleNode and selectNodes methods.
SAXBuilder saxBuilder=new SAXBuilder("org.apache.xerces.parsers.SAXParser");
org.jdom.Document jdomDocument=saxBuilder.build(new File("c:/input.xml"));
org.jdom.Element zipcodeNode= (org.jdom.Element)(XPath.selectSingleNode(jdomDocument,"/Operator//Customer/zipCode")); -
How to get InitialContextFactory using RMI/IIOP without using weblogic.jar
Hi Robert
I know this is an old post. but I am interested in knowing how to get the
initial context using RMI/IIOP without the use weblogic specific classes
like weblogic.jndi.WLInitialContextFactory . If you have a code snippet that
you can provide as an example, it would be just great.
thanx in advance
Daya Sharma
See comments inline...
Stewart Wachs wrote:
I would like to get an initial context to Weblogic JNDI from a client.
code snippet:
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFacorty");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
try {
Context ctx = new InitialContext(ht);
catch(...) {
This works fine when I include weblogic.jar (and other dependend weblogic
jar's) in the classpath.
Is there a way to access WL JNDI from a client without the weblogicclasses
in the classpath?If you are using WLS 6.1, you could use RMI/IIOP to do this but in general,
the
answer is no, you will need at least some of the weblogic classes on the
client.
If not, is there a lightweight jar available for distribution for client
JNDI connectivity?This is something in the works. In addition, a colleague and I are working
on
a white paper that describes the "Thin Client Options with WebLogic Server"
that we hope to make available in the not too distant future...
Are there any licencing issues with distributing the weblogic classes to
clients that need to access WL JNDI?No. WLS is licensed by the server so you are free to distribute
weblogic.jar
to your clients.
Hope this helps,
RobertTake a look at the RMI/IIOP section of our whitepaper "Small Footprint
Client options for BEA WebLogic Server" at:
http://dev2dev.bea.com/resourcelibrary/whitepapers.jsp?highlight=whitepapers
Daya Sharma wrote:
Hi Robert
I know this is an old post. but I am interested in knowing how to get the
initial context using RMI/IIOP without the use weblogic specific classes
like weblogic.jndi.WLInitialContextFactory . If you have a code snippet that
you can provide as an example, it would be just great.
thanx in advance
Daya Sharma
See comments inline...
Stewart Wachs wrote:
I would like to get an initial context to Weblogic JNDI from a client.
code snippet:
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFacorty");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
try {
Context ctx = new InitialContext(ht);
catch(...) {
This works fine when I include weblogic.jar (and other dependend weblogic
jar's) in the classpath.
Is there a way to access WL JNDI from a client without the weblogic
classes
in the classpath?
If you are using WLS 6.1, you could use RMI/IIOP to do this but in general,
the
answer is no, you will need at least some of the weblogic classes on the
client.
If not, is there a lightweight jar available for distribution for client
JNDI connectivity?
This is something in the works. In addition, a colleague and I are working
on
a white paper that describes the "Thin Client Options with WebLogic Server"
that we hope to make available in the not too distant future...
Are there any licencing issues with distributing the weblogic classes to
clients that need to access WL JNDI?
No. WLS is licensed by the server so you are free to distribute
weblogic.jar
to your clients.
Hope this helps,
Robert -
How to get or use "kTextFrameOversetChangeMsg" as serviceid?
Hi all
I've developed a small plugin for handling textframe overflow. I've used service ids "kBeforeSaveDocSignalResponderService", "kBeforeSaveAsDocSignalResponderService". But actually I've to run it, only when overflow occurs.
Steven suggested to use "kTextFrameOversetChangeMsg". I tried, but I dont know exactly how to use it as service id. Could anyone suggest on this?
thanks in advance
A.HakkimThank u both. Pls suggest me how to get serviceid from "kTextFrameOversetChangedMsg".
-
How to get the Wiki search functionality working?
hi,
Another Wiki question regarding the 7.1u1 Portal wiki functionality: What is necessary to get the wiki search functionality working? Right now when using the wiki search page all it does is return to the search form, no errors but no hits either. I guess some additional administrative work is needed to get search working?
thanks, tomhaven't touched anything except for the wiki template jsps to change the design. it is a linux rh4 install. there are no communities on that server (yet), just the wiki portlet in a tab so far. is the wiki search dependent on the portal search server or totally separate (ie self contained wiki search)? any additional services or such that need to be started for it to work?
Maybe you are looking for
-
Safari works for one user but not another on same computer
MacBook with multiple user accounts. Safari (and Firefox) work fine for one user but are unable to open web pages when the other user is logged in. The error in Safar is "Safari can't open the page "http://xxxxxxxxx/" because it could not connect to
-
I decided to install a clean version of Windows 8 as a replacement for Win7. So when I looked at what i should save I decided to make a FireFox sync account to retrieve my data when FireFox was installed on my Notebook again. So today I installed Fir
-
Help!! Can't launch Acrobat 7 Pro (Error locating "updater.api")
Acrobat 7 Pro has worked fine all week, and today - boom! Receiving the following error messages: 1st Error Window "There was an error while loading the plug-in "updated.api". The plug-in failed to initialize. 2nd Error Window " The instruction at "
-
Target Cost in Process Order not calculated
Hello, In Process order, after deliver of FG the target cost is not getting calculated, Could you please help me why the target cost is not calculated in process order. I have configured all setting for WIP and Variance
-
Have to use ctrl click to open pdf's
I want to open pdf documents without having to use ctrl click. What is the fix to use just a mouse click? Thanks...