Questions tagged [buffer]

A buffer is an area of memory set aside for temporary storage of data while it is being moved from one place to another. This is typically done to speed up processes with significant latency, such as writing to a disk, printer or other physical device. The output is ready to be sent to the device before the device is ready to accept it, so it is moved to the buffer so that the sending program does not have to continue waiting.

A may be used when moving data between processes within a computer. This is comparable to buffers in telecommunication. Buffers can be implemented in a fixed memory location in hardware—or by using a virtual data buffer in software, pointing at a location in the physical memory. In all cases, the data stored in a data buffer are stored on a physical storage medium. A majority of buffers are implemented in software, which typically use the faster RAM to store temporary data, due to the much faster access time compared with hard disk drives. Buffers are typically used when there is a difference between the rate at which data is received and the rate at which it can be processed, or in the case that these rates are variable, for example in a printer spooler or in online video streaming.


References

7035 questions
12
votes
1 answer

Convert byte[] to Buffer type

I am working in Android. I need to convert byte[] to Buffer type. In Android, I have seen a type Buffered that I needed to use in particular functions. But, I my data source is type byte[].
user1074474
  • 441
  • 3
  • 7
  • 17
12
votes
3 answers

Max size for Vertex Buffer Objects (OpenGL ES 2.0)

Is there a max size for vertex buffer objects binded to GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER??? Originally, I was drawing a mesh composed of 16 submeshes. For each submesh, I created a vertex buffer and during the rendering phase, I called…
Alvin Heng
  • 121
  • 1
  • 1
  • 4
12
votes
2 answers

How to prevent leaving the current buffer when traversing the jump list in Vim?

I frequently have several buffers open in my Vim session. This means that my jump list stores locations from several buffers. However, frequently when I use the Ctrl+O keyboard shortcut to jump to a previous location, I do not want to leave the…
vimgm
  • 123
  • 5
12
votes
4 answers

Are direct buffers in Java initialized to a default value like arrays?

When I initialize an array in Java like: float[] array = new float[1000]; all elements are initialized to 0. Is that also the case when I allocate a direct buffer like this: FloatBuffer buffer = ByteBuffer.allocateDirect(4*1000).asFloatBuffer(); ?…
Se Norm
  • 1,715
  • 5
  • 23
  • 40
12
votes
5 answers

PHP Flush() not working in Chrome

I stumbled upon this function which promised to work across IE, FF & Chrome. But it does not work in Chrome. Is there a work around? function buffer_flush(){ echo str_pad('', 512); echo ''; if(ob_get_length()){ …
Kavin Anbazhagan
  • 208
  • 1
  • 2
  • 15
12
votes
2 answers

Node.js read a file as a string (not buffer) synchronously

How do I read a file in Node.js as a string and not as a buffer? I'm making a program in Node.js. There I need to read a file synchronously, but if I do that, it returns it as a buffer instead of a string. My code looks like that: const fs =…
milkwood1
  • 385
  • 2
  • 3
  • 16
12
votes
1 answer

Converting png to Tensor tensorflow.js

I'm currently attempting to figure out how to convert a input png into a tensor with tensorflow.js so I can feed it into my model for training. Currently I'm capturing the image, saving it locally, reading it with fs.readFileSync, and then creating…
Royce Birnbaum
  • 185
  • 1
  • 2
  • 12
12
votes
1 answer

How does pcap unix buffering work?

Hypothetical scenario: A udp packet stream arrives at machine X, which is running two programs - one which is listening for the packets with recv(), and another which is running pcap. In this case, as I understand it, the packets are stored in the…
Benubird
  • 18,551
  • 27
  • 90
  • 141
12
votes
2 answers

java.nio.Buffer not loading clear() method on runtime

So I am a developer for a project that uses a java agent to inject. It should be noted though that this error occurs after main is called. Everything is going fine for most users, but a few are having an issue where java.nio.IntBuffer isn't loading…
Alex Pawelko
  • 414
  • 1
  • 4
  • 14
12
votes
2 answers

Resetting byte[] buffer to zeros?

In the following code for sockets, I declare a byte buffer and listen for client messages in a loop: // Create some buffer byte[] buffer = new byte[512]; while (true) { // Listen for messages from Client int length =…
user963241
  • 6,758
  • 19
  • 65
  • 93
12
votes
5 answers

Efficient C# byte queue for parsing stream of bytes for binary message packets

I'm trying to replace what I would usually implement as a circular-buffer+. The function of the queue is to buffer incoming bytes (eg. from serial port or some other stream of data), whilst a parser examines bytes in the queue and detects and…
Prembo
  • 2,256
  • 2
  • 30
  • 50
12
votes
2 answers

How to pass custom class instances through Web-Workers?

Since Web-Worker JSON serialize data between threads, something like this doesn't work: worker.js function Animal() {} Animal.prototype.foobar = function() {} self.onmessage = function(e) { self.postMessage({animal: new Animal()}) …
12
votes
1 answer

Unbinding a WebGL buffer, worth it?

In various sources I've seen recommendations for 'unbinding' buffers after use, i.e. setting it to null. I'm curious if there is really a need for this. e.g. var buffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buffer); // ... buffer…
Brendan Annable
  • 2,637
  • 24
  • 37
12
votes
4 answers

How can I get emacs to open a new buffer quickly?

I used to be able to open a new buffer in Emacs quickly using the command C-x b Somehow I've broken this in my version of Emacs (23.1). When ever I try to do this now I get the message [No match] in the command…
chollida
  • 7,834
  • 11
  • 55
  • 85
12
votes
1 answer

What do "chunk", "block", "offset", "buffer", and "sector" mean?

I have seen some of the scripts which are either dealing with archive or binary data or copy files (not using python default functions) use chunk or block or offset or buffer or sector. I have created a Python application and few of the requirements…
sundar_ima
  • 3,604
  • 8
  • 33
  • 52