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

A binary buffer with no specific encoding.

Examples include byte[] in Java, char[] or uint8_t[] in C++. Objects like std::wstring_t that have a specific encoding (like UTF-8) assigned to them are no byte buffers.

Use this tag only if you're having specific problems in relation with byte buffers. Do not use this tag if there is no indication that the byte buffer you are using has any relation to the problem you're asking about.

919 questions
-1
votes
1 answer

java.lang.UnsupportedOperationException at java.nio.ByteBuffer.arrayOffset?

I need get the bitmap from IFrameCallback which was functioned to deal with the frame from a UVCCamera preview, but there's comes the exception: java.lang.UnsupportedOperationException at java.nio.ByteBuffer.arrayOffset private final…
frank jorsn
  • 489
  • 1
  • 9
  • 27
-1
votes
2 answers

Sending/Receiving object/references or part of Object with JavaNIO

I have designed a real time Physics simulation with NIO, which is about moving balls simultaneously (real time) on multiple clients Currently, i m sending the coordinates of one ball with string parsing, but now i want to move multiple balls and…
static void main
  • 728
  • 2
  • 9
  • 34
-1
votes
1 answer

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 convert data on C++.
Ui-Gyun Jeong
  • 143
  • 1
  • 4
  • 14
-1
votes
1 answer

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 format? what are some chars in above like g,r-,e…
lokanadham100
  • 1,149
  • 1
  • 11
  • 22
-1
votes
1 answer

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[] encrypted => MyDec(encrypt) => byte[]…
Edward
  • 9
  • 5
-1
votes
2 answers

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 uses java nio FileChannel and ByteBuffer to write…
Joss29
  • 19
  • 2
-1
votes
2 answers

My socket isn't sending or receiving bytearrays

I'm trying to send bytes and receive them over my socket connection but they're not doing either. I'm not sure if its a problem to do with the way i'm sending the bytes and strings or because I don't know how to read from server and…
user7500147
-1
votes
2 answers

SocketChannelImpl.write(ByteBuffer[] srcs, int offset, int length) appends ByteBuffer of size 0

I have a client-server application communicating over Java NIO sockets which makes use of the SocketChannelImpl class underneath. When from the senders side, I send a ByteBuffer array of length n elements, the client always receives ByteBuffer array…
jaywalker
  • 1,116
  • 4
  • 26
  • 44
-1
votes
2 answers

ByteBuffer flip when last value is null

I have a method that is supposed to return a ByteBuffer. The meat of the method does the following: if (true) { //code that puts some data into ByteBuffer bb return bb } else { //should not be writing any data to bb //intention:…
-1
votes
1 answer

ByteBuffer parse unsigned int

I am working with java.nio in Java 8. I receive an unsigned int inside the buffer and i want to save it as such, but i get a negative number. final int shouldBePositive = buffer.getInt(); and shouldBePositive is negative. Is there a way to work…
slashms
  • 928
  • 9
  • 26
-1
votes
1 answer

How to update a byte buffer

I want to know if it's possible to update a byte buffer. Say I have the below: ByteBuffer buffer = ByteBuffer.allocate(56); buffer.putInt(12); buffer.putLong(34); buffer.put(byte('A')); Assuming I want to modify the buffer to say the that…
Kaleb Blue
  • 487
  • 1
  • 5
  • 20
-1
votes
1 answer

Render ByteBuffer LWJGL 3

I'm currently trying to learn, how to program with LWJGL 3, and there are not a lot of tutorials/books/documentations about it (not just in java, but in C too). I got over most of these problems, but I couldn't find any materials about how to render…
Bálint
  • 4,009
  • 2
  • 16
  • 27
-1
votes
1 answer

ByteBuffer vs BufferInputStream

Would a NIO ByteBuffer consistently offer a faster read performance than an IO BufferedStream? If so,what would the reason be (keeping aside the multi-threading capbilities of NIO). I read about minimized copying of the read data in the former…
IUnknown
  • 9,301
  • 15
  • 50
  • 76
-1
votes
3 answers

Netty ByteBuf occupies all memory

I wrote a simple code to test the performance my Server while (true) { ByteBuf firstMessage = Unpooled.buffer(8); firstMessage.writeInt(1); firstMessage.writeInt(1); …
user2413972
  • 1,355
  • 2
  • 9
  • 25
-1
votes
1 answer

How to ensure that byte array has converted data from double datatype

I am getting the output [B@3a2fc571 byte[] rate = new byte[8]; ByteBuffer.wrap(rate).putDouble(Flow_Rate); I used the function to write this data of_vendor.setData(rate); But the capacity is same and it is not writing that byte after using the…
Xobiiii
  • 21
  • 7