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
0
votes
3 answers

How to use Byte Buffer to serialize a Byte Array to start following Big Endian format?

I need to write Byte Array value into Cassandra using Java code. Then I will be having my C++ program which will retrieve that Byte Array data from Cassandra and then it will deserialize it. That Byte Array which I will be writing into Cassandra is…
arsenal
  • 23,366
  • 85
  • 225
  • 331
0
votes
1 answer

Receiving larger bytebuffer Android

I'm using the framework Netty with Android and having problems when I receive large amounts of data: @Override public void channelRead(final ChannelHandlerContext ctx, Object msg) { bufferIn = (ByteBuf) msg; if (bufferIn.readableBytes() >=…
Luciano Coelho
  • 89
  • 1
  • 11
0
votes
1 answer

Java Buffer which can tell if it's dirty

Due to the existing structure of code, which looks like this: // Read buffer (using ByteBuffer) // Pass buffer to a remote method, which MIGHT write to it // Write buffer back if dirty I want that my buffer should be able to identify if it is…
user1071840
  • 3,522
  • 9
  • 48
  • 74
0
votes
1 answer

Is there any way to directly save serial port incoming data into file?

I need to save whole incoming serial port data into a file. Some people suggest to use File.WriteAllBytes but it takes the all empty indexes of created byte array. Array.Resize(ref Read_Data2, Read_Data2.Length + incoming.Length); …
Blast
  • 955
  • 1
  • 17
  • 40
0
votes
1 answer

How to read binary file place in server?

I want to read binary file that is placed in server. what i want is data should be placed in bytearray. Following is my piece of code: BufferedReader in = new BufferedReader(new InputStreamReader(uurl.openStream())); String str; while ((str =…
Muneem Habib
  • 1,046
  • 4
  • 18
  • 49
0
votes
2 answers

ByteBuffer in java returning data when nothing is written to it, doesn't throw exception

I have a wrapper around the ByteBuffer class (because in my code, it is underlying structure for an entity). I want a ByteBuffer to store fixed sized entries in it and return null or throw an exception if we try to read at an offset where nothing…
user1071840
  • 3,522
  • 9
  • 48
  • 74
0
votes
3 answers

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes

I've been attempting to solve this problem without any luck. I have four classes, the main class, an Object class, a sprite class and an image loader class. I'm attempting to load a png using the image loader and using the method found here:…
Ooo
  • 195
  • 2
  • 9
0
votes
2 answers

Allocating zero capacity ByteBuffer

Can anybody please tell me what are those possible purposes of allocating zero-length buffer? ByteBuffer.allocate(0); // no IllegalArgumentException Why the one who designed the API did this? Thanks for comments and answers. I hope there will be an…
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
0
votes
1 answer

Inquiry about writing a Char via ByteBuffer

I am wondering why with the following code: SeekableByteChannel seeka = Files.newByteChannel(path,StandardOpenOption.CREATE,StandardOpenOption.WRITE); ByteBuffer src = ByteBuffer.allocate(10); src.putChar('a'); src.flip(); …
Rollerball
  • 12,618
  • 23
  • 92
  • 161
0
votes
1 answer

How Does JVM Store Data to ByteBuffer?

I just learned about Java's ByteBuffer, I am a little confused with how JVM storing multiple data types into a ByteBuffer. This is the codes: public static void main(String[] args) { ByteBuffer BF1 = ByteBuffer.allocate(30); …
NoeL
  • 67
  • 1
  • 1
  • 7
0
votes
1 answer

C# method equivalent to Java's DirectByteBuffer

Im learning how to use C++ DLLs in C# and made a a c++ function that multiplies two allocated (Marshalled) set of variables. Everything works well in both C# and C++ until I increase the combined size of allocations to 1024 from 512MB. Then visual…
huseyin tugrul buyukisik
  • 11,469
  • 4
  • 45
  • 97
0
votes
1 answer

JNA ByteBuffer statvfs

I am trying to get the free space on the / folder using statvfs call from java, I have check the size of statvfs struct from c it shows 44 bytes, I have allocated a byte buffer using java.nio.ByteBuffer.allocateDirect 44 bytes, and it's order is set…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
0
votes
1 answer

My server is sending the information to my client twice. I dont know why

EDIT I have it working now thanks to the comments below. I also explained what I fixed in the comments. Thanks for the help guys. Im working on a multiplayer game in java. It's coming along pretty well so far, but Im having an issue with the server…
0
votes
2 answers

JNI GlobalReference (New/Delete) and java.nio.ByteBuffer what's the relationship in Android NDK context

Have been using java.nio.ByteBuffers on the NDK side for a while now - noticed this article about Android relationship with JNI, GC and future of ICS. Article here…
narkis
  • 335
  • 1
  • 7
  • 17
0
votes
1 answer

ByteBuffer to String

I have developed an application for Http Request and Response in Tizen. I am successfully able to post and get the response.(Checked Body length). The response which I got is in ByteBuffer. ByteBuffer* pBuffer = pHttpResponse->ReadBodyN(); I am…
Cyril
  • 1,216
  • 3
  • 19
  • 40