924 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
3
votes
1
answer
232
views
How to correctly start a byte array's lifetime at a memory address returned by mmap?
I'm working on legacy code that uses mmap to load data from a file:
int fd;
std::size_t fs;
fd = open(filename, O_RDONLY); // error management omitted for the example
fs = get_size_from_fd(fd); // ...
2
votes
0
answers
73
views
CharsetDecoder with DirectByteBuffer and HeapByteBuffer performance difference
My use case is the following: reading DirectByteBuffers from the network and decoding them into UTF-8 strings. I’ve observed that using a UTF_8 CharsetDecoder with a DirectByteBuffer is 3–4 times ...
0
votes
0
answers
161
views
ByteBuffer Decryption
I have been writing a VoIP program and have used the code below to encrypt some data for sending in Java:
private byte[] encryptData(byte[] data){
ByteBuffer unwrapEncrypt = ByteBuffer.allocate(...
0
votes
0
answers
67
views
SSLEngine.unwrap can mutate the source bytebuffer (and a TLS 1.3 question)
Calling SSLEngine.unwrap(srcBB, dstBB) may alter the source ByteBuffer (scrBB) unexpectedly.
As I was examining the source bytes consumed, I rely on srcBB to have its position advanced. It generally ...
0
votes
0
answers
54
views
How to force deallocation memory mapping of a MappedByteBuffer in Java 11 - java.lang.ClassNotFoundException: sun.misc.Cleaner [duplicate]
I'm currently migrating the application code from java 8 to java 11, previously we use the internal class "sun.misc.Cleaner" and now when my application run I got a java.lang....
0
votes
1
answer
54
views
Netty downstream handler buffer management
Had a question about buffer management for Netty downstream buffer sending flow.
I have a Netty SimpleChannelInBoundHandler MainHandler that does 2 things:-
Receives buffer and asynchronously creates ...
1
vote
3
answers
83
views
Questions about non-byte aligned access of STM32F4 series MCU
Recently I encountered a bug in non-aligned byte access, so I did an experiment and encountered some doubts, as follows:
Why does the system not crash when my code below accesses non-aligned bytes?
...
0
votes
1
answer
96
views
netty ByteBuf corruption
I am using ByteToMessageDecoder
decode(ChannelHandlerContext ctx, ByteBuf bytebuf, List<Object> out) {
...
}
I want to perform some validation on incoming bytebuffer and then send bytebuf....
0
votes
0
answers
123
views
Why DirectByteBuffer keeps data on JVM heap instead of native memory in Android?
I wanted use ByteBuffer.allocateDirect to keep data on native memory but it looks like it keeps data on heap.
I used this code to check that DirectByteBuffer keeps data on heap.
import android.util....
0
votes
1
answer
422
views
How to create Javascript WritableStream on memory (like fs.creareWriteStream)
I try to use some JS library with ServiceWorker, without access to Node.JS FileSystem functionality. That original library export result in the same way
Import * as fs from 'fs'
...
JsLib.export(...
0
votes
1
answer
91
views
FIleChannel, ByteBuffer why is postion 0 after read?
public class CodingDecoding
{
public static void main(String[] args)
{
try (
FileChannel out = FileChannel.open(Paths.get("out.txt"),
...
0
votes
2
answers
86
views
String to int to byte array without advanced data types
this might be a difficult question, but I'm trying to do the following:
Take an input string i which i want to be a unix timestamp including miliseconds
Convert this to an int64 byte array, but i can ...
0
votes
0
answers
132
views
Kotlin equivalent of Python's bytes BytesIO struct module
I am totally confused, what are the Kotlin equivalents of Pythons...
bytes - UByteArray yes I know
BytesIO - a byte steam for reading (and later writing) bytes
struct module - for conversion between ...
0
votes
1
answer
226
views
How HeapByteBuffer converts byte array to short
I have a java program, where I m trying to convert a byte array to short.
byte arr[] = {-1,-1};
int value = ByteBuffer.wrap(arr).order(ByteOrder.LITTLE_ENDIAN).getShort();
the value I get from above ...
0
votes
0
answers
250
views
flutter websocket cannot send bytebuffer in mobile app
My flutter app need to send data type bytebuffer from client to sever via websocket. But web_socket_channel is not support send data type bytebuffer or number.
Are there any library support send ...