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 8403887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:27:17+00:00 2026-06-09T22:27:17+00:00

I have following data fields: int iData1 = 100; int iData2 = 5000; float

  • 0

I have following data fields:

int iData1 = 100;   
int iData2 = 5000;
float fData3 = 80.5f;
float fData4 = 100.1f;
String str1 = "BBBB";   

Sending data as byte array as below:

ByteBuffer buf=ByteBuffer.allocate(BUF_SIZE);  
buf.order(ByteOrder.BIG_ENDIAN);
buf.putInt(bData1);
buf.putInt(iData2);
buf.putFloat(fData3);
buf.putFloat(fData4);
buf.put(str1.getBytes());
sendBytes(buf.array());

To parse the byte array received, I can get each field a follow:

iData1 = bbf.getInt();
iData2 = bbf.getInt();
iData3 = bbf.getInt();
fData3 = bbf.getFloat();
fData4 = bbf.getFloat();

But how to get the string data field (str1) in the array received?
Any hint would be highly appreciated.
Thanks!

  • 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-06-09T22:27:18+00:00Added an answer on June 9, 2026 at 10:27 pm

    Put the length of the string before the string. Then read the string in two steps:

    sDataLen = bbf.getInt();
    bbf.get(sData5, 0, sDataLen);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table of data with the following fields EventID : Int, AutoIncrement,
I have the following code: m_curContacts = managedQuery(uri, projection, selection, selectionArgs, sortOrder); String[] fields
I have the following store: Ext.define('Sencha.model.MenuPoint', { extend: 'Ext.data.Model', config: { fields: [ {name:
I have the following fields: Inventory control (16 byte record) Product ID code (int
We have the following class public class TemporalData<T> { private T data; private String
Say I have the following record: data Rec = Rec { field1 :: Int,
I have the following casting problem when my data structure sSpecificData contains a field
I have following data frames > head(elo) date elo 1 1921-12-18 1597 2 1922-05-14
I have following data structure (simplified): A giant list of the class TestClass public
I have following data to save in database using php my data is :

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.