Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

How to implement onFragmented that is sent from server websocket java? (org.java_websocket.Websocket)

source: https://javadoc.io/static/org.java-websocket/Java-WebSocket/1.5.7/org/java_websocket/client/WebSocketClient.html#sendFragmentedFrame(org.java_websocket.enums.Opcode,java.nio.ByteBuffer,boolean)...
Erwin Darsono's user avatar
0 votes
0 answers
46 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....
Etienne's user avatar
0 votes
1 answer
30 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 ...
vjm's user avatar
  • 9
0 votes
0 answers
11 views

When writing data from a ByteBuffer with direct buffer to a parcel, can I avoid of copying it as a temporary array and then parceling it?

I have a ByteBuffer that allocates memory from a Direct Buffer, and now there is some data in it that I want to pass across processes, so I will parcel the data in it as a ByteArray. However, if I ...
progquester's user avatar
  • 1,702
1 vote
3 answers
54 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? ...
kanghao chen's user avatar
0 votes
1 answer
65 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....
abhish_gl's user avatar
  • 401
0 votes
0 answers
68 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....
Денис Рязанцев's user avatar
0 votes
0 answers
21 views

Error java.lang.NoSuchMethodError Can anyone help me resolve it? [duplicate]

Good evening, I know almost nothing about programming, but when compiling an application "that apparently was ready" I come across this error: Error Log [16/05/2024 06:54:06] Exception in ...
Eduardo Silveira's user avatar
0 votes
0 answers
56 views

How can I use ByteBuffer with JDBI / Postgres for bytea columns?

In order to reduce memory allocations, I would like to use Java's ByteBuffer (or Netty's ByteBuf) in conjunction with JDBI. The datastore is Postgresql and I know how to get bytea columns in and out ...
Matthias's user avatar
0 votes
1 answer
216 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(...
Viacheslav's user avatar
  • 1,310
0 votes
1 answer
72 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"), ...
wydra__'s user avatar
  • 13
0 votes
2 answers
74 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 ...
Khasar1's user avatar
0 votes
0 answers
62 views

How to get the masked image from Interactive Segmentation of Mediapipe

I'm working with the next github: github mediapipe but when I'm getting the result in the method onResults I need to build another Bitmap of the masked region only, but I'm doing something wrong ...
Víctor Martín's user avatar
0 votes
0 answers
89 views

Reactor-Core Netty, ByteBuff wrong allocation

I am working on a Java Netty-Reactor core project, I have some issues while receiving messages as ByteBuff. In my project I have a sender(server) that will take an object and create multiple chunks(...
Andrei.R's user avatar
0 votes
0 answers
106 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 ...
ArekBulski's user avatar
  • 5,048
0 votes
1 answer
153 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 ...
Abhinav Singh's user avatar
0 votes
0 answers
192 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 ...
Bình Nguyễn Bá's user avatar
1 vote
2 answers
100 views

Weird behaviour in Java 8 with ByteBuffer and BitSet

I'm new to java and started to implement a UDP sender with BitSet and ByteBuffer for some reason I get behaviour which I would not expect. import java.nio.ByteBuffer; import java.nio.ByteOrder; import ...
pdesolver's user avatar
1 vote
1 answer
54 views

Create BMP File with byte array

I have a problem with the code, the idea is to create an image in black, and then make color changes. At the moment the only thing I want to do is to create the black image using the ByteBuffer class, ...
Julian's user avatar
  • 11
1 vote
1 answer
115 views

Java, ByteBuffer get byte[] through array(), then convert byte[] to file. The file is different from the origin one [closed]

Method 1 ByteBuffer byteBuffer = reqData.getByteBuffer(); File localFile = new File(ROOTPATH, localFileName); FileUtils.copyInputStreamToFile(new ByteArrayInputStream(byteBuffer.array()), localFile); ...
张拉拉's user avatar
-1 votes
1 answer
65 views

First byte is suddenly zeroed while converting to CString

I want to do FFI call. To do so i need to convert a Rust string into C-zero-terminated-string in a proper encoding. I wrote this code but somehow it replaces first byte with zero. Why this happen? How ...
osseum's user avatar
  • 186
0 votes
1 answer
616 views

Move the pointer in a bytearray as seek does for a BinaryIO

If I have a binary file, I can open it in mode rb and move the pointer with .seek(): with open(fname, "rb") as fid: fid.seek(101) But this is not possible with a bytearray:bytearray(10)....
Mathieu's user avatar
  • 5,706
0 votes
1 answer
130 views

struct.pack gives different results when calling it again after reassigning one of its inputs

I am writing a Python script to send ICMP packets by following an example from a Japanese website. There is part of the code where struct.pack is used to pack series of variables into a bytes array. ...
Hafiz Hilman Mohammad Sofian's user avatar
3 votes
0 answers
1k views

Kafka producer, direct byte buffer memory leak

We have a service that listens on an mqtt channel for measurements. After some conversions these measurements get put on kafka. This all works fairly well, but there is a memory leak, somewhere, which ...
Taliebram's user avatar
  • 151
0 votes
1 answer
441 views

Is there a better way to convert between two Byte Buffers of two different classes?

So, I'm using the TagLib Library in combination with the Godot Engine and I want to send big amounts of Data between those two in the form of Byte Arrays. The Problem is both have their own variables ...
LyffLyff's user avatar
1 vote
1 answer
176 views

Is it possible for byte arrays, returned from BufferedStream.Read(), to have different lengths?

We have this old code in our repo: bool BufferByteCompareFiles(string filePath1, string filePath2) { int bufferCapacity = 0x400000; var firstFile = File.OpenRead(filePath1); ...
notarobot's user avatar
  • 119
0 votes
1 answer
707 views

Java ByteBuffer: How to allocate a buffer of capacity size type LONG?

Currently getting integer overflow on ByteBuffer allocate(int capacity) in Java, where capacity > max value of integer in Java. How can I allocate a byte buffer of capacity larger than INTEGER....
Peabrain's user avatar
  • 589
0 votes
1 answer
619 views

Unable to release memory bytes buffer

Go 1.18.1 pprof report 3549.93kB 49.73% 49.73% 3549.93kB 49.73% src/lag_monitor.PublishLagMetricToDataDog 514kB 7.20% 56.93% 514kB 7.20% bufio.NewWriterSize 512.88kB 7.18% 64.11% ...
uzumas's user avatar
  • 678
0 votes
0 answers
29 views

java jna negative value returned in ByteBuffer from a native function [duplicate]

I use a native C function from a dll like that: short sSmartISOEx(USHORT usInDataLen, const UCHAR *pucDataIn, USHORT *pusOutDataLen, UCHAR *pucDataOut); This function is declared in my java like that:...
guiguietben's user avatar
1 vote
1 answer
520 views

Writing to output stream in chunks in Groovy

I'm getting Jenkins console logs and writing them into an output stream like this: ByteArrayOutputStream stream = new ByteArrayOutputStream() currentBuild.rawBuild.getLogText().writeLogTo(0, ...
anechkayf's user avatar
  • 545
0 votes
1 answer
116 views

can TextWebSocketFrame be declared with static and final?

In Netty, send messages are like this: channel.writeAndFlush(new TextWebSocketFrame("Operation Succeed")); to run this code, nothing abnormal. so I think, argument from writeAndFlush can be ...
kiki's user avatar
  • 3
5 votes
1 answer
931 views

How to make ByteBuffer as efficient as direct byte[] access after JIT has warmed up?

I am trying to optimize a simple decompression routine, and came across this weird performance quirk that I can't seem to find much information on: Manually implemented trivial byte buffers are 10%-20%...
byteit101's user avatar
  • 3,990
0 votes
2 answers
88 views

Write a Java8 library which can use java9 features if running in Java9 or greater

I want to write a java8 library and I have to compile it with java8 because it uses a ByteBuffer which has some nasty method signature change (which then throw the infamous error “method not found”). ...
daniele.guiducci's user avatar
1 vote
0 answers
78 views

Adding tflite model to Kotlin

val model = Action.newInstance(this) // Creates inputs for reference. val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 30, 126), DataType.FLOAT32) inputFeature0.loadBuffer(byteBuffer) ...
Minhaaz's user avatar
  • 21
0 votes
1 answer
226 views

Netty 4 - Copy specific nr of bytes from ByteBuf into Native ByteBuffer

I've been implementing Netty 4 on my app and I've ran into a limitation which I would like to optimize. I'm using NioSocketChannel where when I receive data, the final object it needs to end up into ...
Ralms's user avatar
  • 532
0 votes
0 answers
392 views

Java - Read from InputStream to ByteBuffer by chunk size

I am using Cronet API with our current API stack, specifically UploadDataProvider, there is a ByteBuffer with preset limit, seems like the limit size is fixed and we need to pass the data chunk by ...
Cheng's user avatar
  • 785
1 vote
1 answer
403 views

Java ByteBuffer similar function in Python

I need to reimplement following function which converts 8 digit List to 32 digit List via ByteBuffer to python. So it can be used a python pipeline. As a data scientist, I have been scratching my head ...
user1269298's user avatar
-1 votes
1 answer
475 views

java ByteBuffer to int array conversion fails with UnsupportedOperationException

When converting a ByteBuffer to an int array java unexpectedly throws an UnsupportedOperationException. However as a byte array the information is correctly represented. int[] intArray = new int[]{1, ...
Seb's user avatar
  • 1,686
0 votes
1 answer
69 views

Writing shorts greater than 127 to a ByteBuffer in Java

I have an application in which I'm trying to send UDP messages using TSLv5. The protocol is somewhat complicated, but to do it I need to write 16 bit values as little-endian and then send that via UDP....
user1513171's user avatar
  • 1,974
3 votes
1 answer
857 views

Java: Performance of ByteBuffer versus jdk.incubator.foreign (Panama) Foreign Memory methods (MemoryLayout/Segment)

Background I'm self-studying databases in my spare time, trying to learn by implementing one ground-up. One of the first things you have to implement is the underlying data format and storage ...
Gavin Ray's user avatar
  • 725
2 votes
0 answers
3k views

How to get the responseBody of a FeignException

I'm trying to get response body out of an FeignException and the responseBody is there as ByteBuffer. within the byte buffer there is a heapBuffer which has the content I want. but I can't access it. ...
manuradha's user avatar
2 votes
1 answer
183 views

In my C# app. I am reading the CNC program of a remote machine into a byte buffer. How can I read this byte buffer line by line in to a string array?

I can read the complete CNC program of a remote machine to a byte buffer with a third party dll. After that I have to read the byte buffer line by line and transfer it to a string array.(I don't want ...
Mdarende's user avatar
  • 719
1 vote
1 answer
2k views

Can I stream data from a writer to a reader in golang?

I want to process a number of files whose contents don't fit in the memory of my worker. The solution I found so far involves saving the results to the processing to the /tmp directory before ...
Jader Dias's user avatar
  • 90.3k
0 votes
0 answers
149 views

Converting Java ByteBuffer saved to sqlite to Python native data

I am trying to access a database column for the game Project Zomboid. There is a table named NetworkPlayers which has a binary BLOB data column. An example of which contents is below: \x01\x01\x00\x00\...
Swift's user avatar
  • 1,711
0 votes
0 answers
154 views

NSData methods equivalent in Java

I am trying to match iOS code to Java code, and I run into the problem. I read all the answers and as far as I understood I need to use ByteBuffer as an equivalent to NSData in Swift. But I couldn't ...
Anush Hakobyan's user avatar
1 vote
1 answer
636 views

How to increment a byte array by one

In RocksDB, we are able to perform range scan based on a key. We first seek to the start position by initializing byte[]. For example if your key is composed of two Long data types, we can initialize ...
user_1357's user avatar
  • 7,930
1 vote
1 answer
780 views

How do you create a numpy array from a mixed type byte array where you know the offsets to each type with zero copy?

I have mixed data stored in a byte array in the following format [ np.int64(1) np.int64(2) np.int64(3) np.float32(1.0) np.float32(2.0) np.float32(3.0) np.float64(1) np.float64(2) np.float64(3) ] I ...
Ghastone's user avatar
0 votes
0 answers
323 views

hello i am getting this error The size of byte buffer and the shape do not match

i am trying to develop my first android application using a tensorLite model but i keep on getting the error:java.lang.IllegalArgumentException: The size of byte buffer and the shape do not match. ...
Brighton Mushavanhu's user avatar
-1 votes
1 answer
415 views

ImageIo reading from byte data results in "Empty region!"

I have two services which trade binary data from an original heic/heif image via redis (binary safe). Since ImageIo does not support that image type I built a separate service in nodejs, which just ...
NightKnight's user avatar
0 votes
1 answer
2k views

java.lang.IllegalArgumentException: The size of byte buffer and the shape do not match

TensorBuffer inputFeature0 = TensorBuffer.createFixedSize(new int[]{1, 224, 224, 3}, DataType.UINT8); ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4* imageSize * imageSize * 3); ...
Sathish's user avatar
  • 1,475

1
2 3 4 5
19