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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:27:57+00:00 2026-06-15T17:27:57+00:00

So by my understanding for thrift, Java is the only language supported that does

  • 0

So by my understanding for thrift, Java is the only language supported that does not have binary-safe Strings, hence the thrift binary type. My problem is it doesn’t seem to work.

My definition File is:

service myService {
     int myMethod(1:binary input)
}

My Java client builds a ByteBuffer from binary data that is observed to have positive length, and printable bytes prior to calling myMethod.

Immediately inside the C++ implementation of myMethod (from the thrift generated server skeleton), attempts to print input show it as always being empty of size 0.

Any ideas what I’m missing here? Changing binary to string makes everything work like a charm, minus the fact that I don’t want the unsafe java-converted string to deal with later…

  • 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-15T17:27:57+00:00Added an answer on June 15, 2026 at 5:27 pm

    Most likely you’re having problem because ByteBuffer in Java has mutable state. So, any read operation actually modifies ByteBuffer, since it modifies read position.

    The simpliest (whereas not the most effective) way to work with thrift binaries in java is creating binaries as byte arrays and using wrapping them info buffers immidiately before invocation, i.e.:

    byte[] input = ....;
    myService.myMethod(ByteBuffer.wrap(input));
    

    Another possible solution is to use ByteBuffer.duplicate to keep original buffer safe, i.e.:

    ByteBuffer input = ....;
    dump(input.duplicate());// dump function may change buffer position
    myService.myMethod(input);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My understanding is that, in keeping with Interbase v6, Firebird 2.5 does not support
My understanding is that when using && as an mathematical operation in Java, if
My understanding is that Java's implementation of regular expressions is based on Perl's. However,
My understanding is that Processing.js converts Processing code into javascript. But if one does
My understanding is that you have to write unit tests that isolate functionality. So
My understanding was that Python strings are immutable. I tried the following code: a
My understanding is that find only takes the primary key as the parameter. That
My understanding is that ASP.NET MVC only allows you to POST objects to Actions
My understanding of Dart leads me to believe that this 'cast' should not affect
My understanding of the Objective-C id type is that it's a pointer to an

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.