Questions tagged [bytebuffer]

A binary buffer with no specific encoding. Use this tag only if you're having specific problems in relation with byte buffers

0
votes
0answers
10 views

Sending ByteBuffer through Firebase

I am sending ByteBuffer (Protobuf encoded message) though FCM, but not able to parse it on client end (Android). Any help would be appreciated. How can we transmit ByteBuffer through FCM. While ...
0
votes
1answer
41 views

JTextField is updating String data along with junk

I'm trying to update received ByteBuffer data (converted to String) to JTextField, but text field is printing output data along with junk values, even after trimming the string. But in output ...
-1
votes
0answers
47 views

How can I read a file byte by byte in C?

This is part of a program that is supposed to read byte by byte from a memory card to retrieve lost images. I ran a debugger and found that the if block is never executed even though I read into a ...
0
votes
0answers
29 views

Netty server's channelRead receives empty ButBuf with 0 size

------------ client-side pipeline (Client can send any type of messages i.e. HTTP requests, or binary packets)--------Bootstrap bootstrap=new Bootstrap().group(group)// .option(...
0
votes
0answers
65 views

Cassandra 3.2 crashing at cassandra.db.marshal.TimestampType.compareCustom(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I

Issue:Cassandra crashing in every 3-4 hrs with:# J 8283 C2 org.apache.cassandra.db.marshal.TimestampType.compareCustom(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I (6 bytes) @ 0x00002b7d3d417fb4 [...
-1
votes
2answers
61 views

Is there a legal way to convert a unsigned char pointer to std::byte pointer?

I use the STB library to load images into memory. The specific function, stbi_load, returns a pointer to an unsigned char, which is an array.I'm tempted to use the new C++17 API for raw data, std::...
0
votes
0answers
24 views

How to get pixel's RGB from ByteBuffer with RGB_565 on Android

I have ByteBuffer which contains pixels in format RGB_565. ByteBuffer is size 320x200*2. Each pixel is stored in two bytes.I am getting first byte location for each pixel with (y * 320) + x.Please ...
0
votes
0answers
19 views

Android Camera2Api Image ByteBuffer performance

I was trying to use Camera2API google sample https://github.com/googlesamples/android-Camera2Video to convert yuv frame into rgb. I changed sources by deleting recording functionality and adding ...
1
vote
1answer
46 views

C# Modbus frame splitting and storing procedures

The PremiseI am continually polling custom modbus frames from an embedded device with my c# wpf application at a low interval. At the moment the bytes in the frame i receive are located at the same ...
0
votes
0answers
19 views

Converting RSA private key and certificate to C array

I have generated private key and certificate using OpenSSL commands as belowopenssl genrsa -out key_file_name.key 512openssl req -sha256 -new -key key_file_name.key -out certificate.csropenssl ...
1
vote
1answer
35 views

Parsing ByteBuffer in node?

I have data from an api that has returned like this:var body=data;data is equal to:ByteBuffer {buffer:<Buffer 09 62 61 1f 04 01 00 10 01 11 61 99 5d 05 01 00 10 01>,...
0
votes
2answers
37 views

Manipulating with large byte array input

I'm working on a project where I'm getting a large (70k) array of bytes. I have to decode it and parse the result properly, based on the data.Array is built like this:{ header_cells, dataType1, ...
-1
votes
1answer
36 views

How to convert data sending data through TCP from C++ to Java

I'd like to send some data from C++ to Java via TCP.On Java, I will use ByteBuffer to get receiced data.When bytebuffer.getInt(), I' like to get int data which is sent on C++.To do this, how do I ...
0
votes
2answers
29 views

netty: How to edit the backend array of bytebuf in place?

In my use case, I need to xor each byte before reading from or writingto the network. So I implement a duplex handler to do this.But it's weird that I could not edit the output bytebuf in place,...
1
vote
2answers
67 views

Convert two bytes to a signed integer in java

Question in shortIs there a way to read two bytes as a signed integer?Details & exampleGiven two bytes in java, each represents an integer, we can convert them to the int value they ...
-3
votes
1answer
34 views

Netty ByteBuf receive-size !=send-size

I have a little error wih my netty-server. I need to transfer different byteBuf sizes (the send-buffers capacity is dynamicly increased).byte[] buffer=text.getBytes();byteBuffer.writeInt(...
-1
votes
1answer
50 views

Understanding string escape sequences

I am new to go, so lot of confusion regarding bytes concept.While going through some go code, I came across some thing like[]byte("\xd2\xfd\x88g\xd5\r-\xfe")was it in hexa decimal or bytes ...
2
votes
1answer
22 views

How to assign and retrieve a unsigned Long value to ioBuffer

How to assign a unsigned Long value to ioBuffer( apache mina)My requirement is :I Would have a unsigned Long value ie a value upto 2^64-1=18446744073709551615,which needs to be set into a ...
0
votes
0answers
24 views

how to return a byte[] of bitmap from surface

This code is as follow:public static Bitmap getScreenShot(ImageReader imageReader) {Bitmap bitmap=null;Image image=imageReader.acquireLatestImage();if (image !=null) {...
2
votes
1answer
55 views

How get an RGB Bitmap by using ByteBuffer (no color correction)?

I have an mp4 video in my sd cardMediaFormat={repeat-previous-frame-after=66666,mime=video/avc,frame-rate=15,color-format=2130708361,...
0
votes
0answers
41 views

jni: c to java char* buffer data passing in a generic format

We have a legacy C api that connects to a provider and gets market data at approx 100msgs/sec. All these messages are returned as (char*, headerSize) format. From that point onwards we do a lot of ...
3
votes
1answer
88 views

Why does DirectByteBuffer.array() have extra size?

My code is:if (frameRGBABuffer==null) {frameRGBABuffer=ByteBuffer.allocateDirect(cameraHeight * cameraWidth * 4).order(ByteOrder.nativeOrder());}Log.d("tag",frameRGBABuffer....
0
votes
0answers
51 views

converting ByteBuffer data to Pcap format

I had a created a localhost VPN server on android and my packets are in ByteBuffer format.In order to verify the packet's correctness I need to save the packets in a pcap file.Is there viable ...
-1
votes
1answer
50 views

C# Aes byte[] Encrypt/Decrypt : not a complete block

I get error "the input data is not a complete block", I dont know if my code is wrong or something is missing. i try to encrypt/decrypt bytes with same lenght.=byte[] plain=> MyEnc(plain)=> byte[]...
1
vote
1answer
43 views

Writing the contents of a ByteBuffer to a DataOutput?

The object to which I need to write a ByteBuffer is typed as an instance of interface DataOutput, rather than as an instance of class DataOutputStream (which implements DataOutput). I need to assume ...
2
votes
1answer
268 views

Basler USB Camera byte buffer to image conversion

I have Basler acA3800 USB camera.IGrabResult grabResult=camera.StreamGrabber.RetrieveResult(5000, TimeoutHandling.ThrowException);// Image grabbed successfully?...
1
vote
2answers
49 views

Releasing a direct buffer in java and possible pitfalls

we have the following piece of code:long buffer=((DirectBuffer) ByteBuffer.allocateDirect(256)).address(); It seems that there is no reference to direct buffer (as an object) on the thread's ...
1
vote
0answers
59 views

bytebuffer write cost too much time

I made a load test for rocketmq, then I found a lot of long call,the long call cost much more then 100ms.But I read the source code of the long call,the main cost is the writing of bytebuffer. The ...
1
vote
1answer
36 views

Shader Storage Buffer Objects: endianness?

OpenGL ES 3.1, Android.I have set up SSBO with the intention to write something in fragment shader and read it back in the application. Things almost work, i.e. I can read back the value I have ...
0
votes
0answers
30 views

Java nio Byte Ring Buffer for audio input

I am trying to implement a ring buffer in java for recording audio input. However I am confused as to how to read a targetdataline to a ring buffer. For reading bytes from a targetdataline it ...
4
votes
1answer
86 views

How to extract used byte array from ByteBuffer?

The java.nio.ByteBuffer class has a ByteBuffer.array() method, however this returns an array that is the size of the buffer's capacity, and not the used capacity. Due to this, I'm having some issues....
0
votes
1answer
62 views

BufferOverflowException while sending data of specific size

I have bunch of keys and values that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K ...
0
votes
2answers
81 views

Java Audio Byte Buffer takes varying times to fill

I am opening a targetdataline to accept audio input for a given format. I start and open the line, and I have a buffer which fills with bytes. This runs on a constant loop until an external ...
0
votes
1answer
56 views

MediaCodec: adjust the ByteBuffer values to match BufferInfo (not needed?)

I'm using a MediaCodec to record a .MP4 video (Image and audio). I have seeing a lot of source codes with the comment before to set the position and limit of ByteBufferhttp:// adjust the ByteBuffer ...
1
vote
0answers
53 views

Android MediaExtractor / MediaCodec Native Crash

I have developed a simple audio player in Android that, among others, plays .mp3-files. To decode the files I am using the Android MediaExtractor and the Android MediaCodec.The sample code looks as ...
0
votes
0answers
27 views

Client application's message from server side is padded when printing out

I wrote a java client using socket to continuously receive message from my client. My server is written in c and send data using write(client_sock, "Connected successfully", strlen("Connected ...
4
votes
3answers
40 views

Why doesn't ByteBuffer preserve index for putDouble and getDouble?

I'm having difficulty understanding the semantics of ByteBuffer in the following scenario:int sizeOfDouble=8;int numberOfDoubles=4;ByteBuffer testBuf=ByteBuffer.allocateDirect(sizeOfDouble*...
1
vote
1answer
11 views

Importing content into allocated ByteBuffer

I have this file that I need to read using an allocated buffer:ByteBuffer buff=ByteBuffer.allocate(n);But I can't seem to understand how to move data into the buffer before I can print it to ...
1
vote
2answers
101 views

Java - '\' not being used to escape double quotes " in string

I have some JSON content in bytebuffer as : {\"ID\":101}"}This content is being returned from a service invocation. I get result from that microservice in a bytebuffer. (This means - I cannot get ...
1
vote
2answers
214 views

Upload file via WebSocket (BinaryWebSocketFrame) and Netty

I'm trying to upload a file via websockets with the following code:let file=e.target.files[0]let ws=new WebSocket("ws://127.0.0.1:8080/")ws.binaryType="arraybuffer";var reader=new ...
10
votes
3answers
336 views

Java - optimize writing values as bits to bytebuffer

I am currently working on some networking code (this is my first server) and had a quick question about optimizing a specific function which writes values as bits and then packs them into a byte. The ...
6
votes
2answers
227 views

What is difference between getXXXVolatile vs getXXX in java unsafe?

I am trying to understand the two methods here in java unsafe:public native short getShortVolatile(Object var1, long var2);vspublic native short getShort(Object var1, long var2);What is ...
0
votes
1answer
402 views

java.lang.UnsupportedOperationException at java.nio.ByteBuffer.array(ByteBuffer.java:959)

The following Java code compiles, but there's an error at runtime:# javac ByteBufTest.java# java ByteBufTestException in thread "main" java.lang.UnsupportedOperationExceptionat java.nio....
1
vote
1answer
178 views

Read n bytes of text from file

I have a text file, I read first line from it to find out how many bytes does it take,open($fh, "<:raw", $file);my $len;while (my $row=<$fh>) {$len=length $row;last;};Now I ...
0
votes
1answer
124 views

Java Buffer mark and reset in a for loop

I've seen production code that mark and rest a buffer position initialized in a for loop every time. Is it necessary? */public static void writeToBuffer(final List<ByteBuffer> attachments, ...
0
votes
1answer
79 views

Duplicate the audio ByteBuffer in ExoPlayer

I'm trying to process the audio buffer in the Android ExoPlayer. In the writeBuffer function of the DefaultAudioSink class, Audio data's coming in a ByteBuffer object. In my case, I want to get the ...
0
votes
1answer
105 views

ByteBuffer Zeroing?

Good morning.Netty is the description part of byteBuffer in official website."If java.nio.ByteBuffer is assigned, its contents are filled with 0. This" zeroing "consumes CPU cycles and memory ...
1
vote
2answers
161 views

Java - CRC32.update() on concatenated ByteBuffer

I have the following function:byte[] test1={1,2,3,4};byte[] test2={5,6,7,8};ByteBuffer bbtest1=ByteBuffer.wrap(test1).order(ByteOrder.LITTLE_ENDIAN);ByteBuffer bbtest2=...
-1
votes
2answers
52 views

Spaces added when writing files

I'm modifying the source code of H2 MVStore 1.4.191 to write files by doing some thread sleep.The big change is that the file is not written in one time anymore, but by 2^16 bytes chunks.MVStore ...
8
votes
6answers
369 views

Send data in multiple ways depending on how you want to send it

I have bunch of keys and values that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,