Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5992715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:34:21+00:00 2026-05-22T23:34:21+00:00

Background I’m working with byte arrays in JNI . And I can’t get length

  • 0

Background

I’m working with byte arrays in JNI. And I can’t get length of jbyteArray. I’m writing code in eclipse in Windows 7.

Java code:

private native int Enroll( byte[] pSeed );

JNI code:

In JNI I have a struct that have two members unsigned long length and unsigned char data[1]

typedef struct blobData_s {
    unsigned long     length;
    unsigned char     data[1];
} blobData_t;

Now as my JNI function get as argument jbyteArray jpSeed i want to get the length of jpSeed and set it as length member of struct.

JNIEXPORT jint JNICALL Java_com_Test_Enroll( JNIEnv* env, jobject thiz, jbyteArray jpSeed ){
     blobData_t* bd = malloc( sizeof(blobData_t) );
     bd->length = **Question 1**
     bd->data[1] = jbyteArray;
}

Question 1: How I can get the length of jpSeed in JNI ?

Question 2: Will this code works correct bd.data[1] = jbyteArray; ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:34:21+00:00Added an answer on May 22, 2026 at 11:34 pm
    1. You can use GetArrayLength(JNIEnv* env, jbyteArray array) Read here.

    2. Not sure what you want to do, I assume you want the content of jpSeed in bd.data[1].
      Anyways, accessing the contents of a byte array, should be done with GetByteArrayElements(...).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I am writing code in VS 2010, .NET 4, C#. Also, in case
Background: I'm writing a 'standard' (nothing special) web application in Ruby (not Rails) and
Background I am writing and using a very simple CGI-based (Perl) content management tool
Background This is only my second PyQt4 project. Developing a Windows app that has
Background information: I have the following code in a WCF service. GetDataTable returns a
Background: I am using Eclipse to develop an Android app. I have an xml
Background I first wanted to upload a file via json and get a response
Background: I'm working through the Programming Collective Intelligence book by Toby Segaran; specifically the
Background Developing a simple web application (Eclipse + JBoss + Apache Tomcat) to generate
Background: I am writing a flash game and have encountered a problem. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.