Questions tagged [bytestream]

A bytestream is a series of bytes.

Formally, a byte stream is a certain abstraction, a communication channel down which one entity can send a sequence of bytes to the entity on the other end. Such channel is often bidirectional, but sometimes unidirectional. In almost all instances, the channel has the property that it is reliable; i.e. exactly the same bytes emerge, in exactly the same order, at the other end.

Less formally, one can think of it as a conduit between the two entities; one entity can insert bytes into the conduit, and the other entity then receives them. This conduit can be ephemeral or persistent.

See more:

173 questions
4
votes
1 answer

Read bytes from a Class file within a Jar file

I have a .jar file which has .class files and .java files. I want to load the contents of a specific .class file as a byte[] array. static byte[] getBytes(String javaFileName, String jar) throws IOException { try (JarFile jarFile = new…
akhiljain
  • 621
  • 1
  • 9
  • 18
3
votes
1 answer

How to convert audio byte stream to torch tensor?

I am trying to convert bytes audio stream to PyTorch tensor as input to PyTorch's forward() function. (To be more specific, I am using a Nemo Speaker model for speaker identification: audio_signal, audio_signal_length = torch.tensor([audio]),…
xujinghua
  • 31
  • 2
3
votes
2 answers

Java application server without HTTP

I have a client software that is written in C++/C# and a database. Now I don't want the client to access the database directly, so I thought about placing an application server in the middle. This one should get a short request from the client, ask…
3
votes
1 answer

TCP Receive in Python, reading the data out

My Python script is as below (sensitive data removed where necessary) import socket class TCPConnection: def __init__(self, sock=None): if sock is None: self.sock = socket.socket( socket.AF_INET,…
oliversarfas
  • 86
  • 1
  • 9
2
votes
1 answer

Filtering byte stream efficiently before converting to numpy array / pandas dataframe

I'm looking for guidance on how to efficiently filter out unneeded parts of my data before converting to a numpy array and/or pandas dataframe. Data is delivered to my program as string buffers (each record separately), and I'm currently using…
StevenS
  • 662
  • 2
  • 7
2
votes
2 answers

In Perl, how to create a "mixed-encoding" string (or a raw sequence of bytes) in a scalar?

In a Perl script of mine, I have to write a mix of UTf-8 and raw bytes into files. I have a big string in which everything is encoded as UTF-8. In that "source" string, UTF-8 characters are just like they should be (that is, UTF-8-valid byte…
Kzwix
  • 161
  • 7
2
votes
1 answer

Python image in `bytes` - get height, width

I'm trying to detect width and height of an image before saving it to the database and S3. The image is in bytes. This is an example of an image before saved to Django ImageField: NOTE: I don't want to use ImageFields height_field and width_field…
Milano
  • 18,048
  • 37
  • 153
  • 353
2
votes
1 answer

Load raster from bytestream and set its CRS

What I want to do : load a raster from an s3 bucket in memory and set its CRS to 4326 (it has no crs set) What I have so far: import boto3 import rasterio from rasterio.crs import CRS bucket = 'my bucket' key = 'my_key' s3 =…
GStav
  • 1,066
  • 12
  • 20
2
votes
2 answers

Convert bytes to a file object in python

I have a small application that reads local files using: open(diefile_path, 'r') as csv_file open(diefile_path, 'r') as file and also uses linecache module I need to expand the use to files that send from a remote server. The content that is…
ItamarG
  • 406
  • 5
  • 14
2
votes
1 answer

cout chr(10) adds a superfluous chr(13) before it

I have two c++ exes communicating over iostream. First exe sends a stream of chars (or bytes) and second intercepts this and decodes them. exe1.exe emits chars: void main() { for (int i = 0; i < 256; ++i) cout <<…
ssg
  • 83
  • 6
2
votes
0 answers

chunks from javascript to bytes or stream with flask API

I am sending chunks of audio data from javascript browser using getUsermedia to flask python api for speech to text. Initially I used to convert audio chunks to blob and then used file approach for speech text. Now i would like to use stream instead…
2
votes
1 answer

Appending null bytes to file in python3 using sparse method?

If I was creating a sparse file from scratch and I wanted to make it the size of n I would use bytestream.seek(n-1) to offset the pointer and then write a single null byte at the end. Much quicker than writing a bytestream of n length! However, if…
hedgehog90
  • 1,402
  • 19
  • 37
2
votes
0 answers

Can someone explain MPEG2 TS (Transport Stream) bytes structure with example?

I'm trying to understand TS bytes structure, I find a source on wikipedia but without example i can't understand totally, I just understand a TS file contains a group of 188 bytes pocket with sync byte 0x47 header and payload data. But i can't…
2
votes
3 answers

Convert an unsigned byte stream to signed bytestream Golang

What is the best way to convert an bytestream to a bytestream slice in Golang? Currently I'm trying to replicate a java program in golang and I believe I am having some issues with the fact that java reads the bytestream as a signed value, whereas…
andor kesselman
  • 1,089
  • 2
  • 15
  • 26
2
votes
2 answers

Python String Prefix by 4 Byte Length

I'm trying to write a server in Python to communicate with a pre-existing client whose message packets are ASCII strings, but prepended by four-byte unsigned integer values representative of the length of the remaining string. I've done a receiver,…
KDM
  • 152
  • 12
1
2
3
11 12