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

convert a byte array to string

My Scala code received a binary from byte stream,it looks like [61 62 63 64].The content is "abcd". I use toString to convert it p, but failed. How do I print it as string ?
Robin
  • 695
  • 1
  • 7
  • 10
32
votes
3 answers

How to download a file using a Java REST service and a data stream

I have 3 machines: server where the file is located server where REST service is running ( Jersey) client(browser) with access to 2nd server but no access to 1st server How can I directly (without saving the file on 2nd server) download the…
Alex
  • 2,213
  • 4
  • 32
  • 44
17
votes
3 answers

Difference between byte stream and bit stream

So far I thought they are the same as bytes are made of bits and that both side needs to know byte size and endiannes of the other side and transform stream accordingly. However Wikipedia says that byte stream != bit stream…
user1042840
  • 1,925
  • 2
  • 16
  • 32
16
votes
2 answers

How can I convert bytes object to decimal or binary representation in python?

I wanted to convert an object of type bytes to binary representation in python 3.x. For example, I want to convert the bytes object b'\x11' to the binary representation 00010001 in binary (or 17 in decimal). I tried…
KaramJaber
  • 851
  • 5
  • 13
  • 24
14
votes
3 answers

How to pause/resume downloading with okhttp in Android

I use okhttp library for download files in android. I download successfully. But something is wrong when I pause and resume download. Response request = new Request.Builder().url(url).build(); ResponseBody responseBody = response.body(); File file…
Alexander
  • 1,720
  • 4
  • 22
  • 40
9
votes
3 answers

java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J

I'm getting this "java.lang.NoSuchMethodError: com.google.common.io.ByteStreams.exhaust(Ljava/io/InputStream;)J" error while using ServiceCredentials.fromStream() method. Anyone here faced this and know a fix? TIA
samuel vishal
  • 135
  • 1
  • 6
7
votes
1 answer

Flutter just_audio package how play audio from bytes

I'm using just_audio plugin and it has on description a feature: Read from byte stream. Basically when I put a file (from url) to play, I'm saving the bytes from file so after this step I want to play it locally. I have a question about how play…
Lauro Victor
  • 71
  • 1
  • 4
5
votes
2 answers

Convert DOCX Bytestream to PDF Bytestream Python

I currently have a program that generates a .docx document using the python-docx library. Upon completing the building of the .docx file I save it into a Bytestream as so file_stream =…
johnstoia
  • 81
  • 6
5
votes
3 answers

Efficient streaming and manipulation of a byte stream in Haskell

While writing a deserialiser for a large ()* encoded binary file I got stuck with the various Haskell produce-transform-consume libraries. So far I'm aware of four streaming libraries: Data.Conduit: Widely used, has very careful…
mcmayer
  • 1,931
  • 12
  • 22
4
votes
1 answer

Python requests: Stream iter_content chunks into a pandas read_csv function

I'm trying to read a huge csv.gz file from a url into chunks and write it into a database on the fly. I have to do all this in memory, no data can exist on disk. I have the below generator function that generates the response chunks into Dataframe…
ChatNoir
  • 415
  • 8
  • 18
4
votes
4 answers

Difference between bytes() and b''

I have the following str: "\xd0\xa0\xd0\xb0\xd1\x81\xd1\x88\xd0\xb8\xd1\x84\xd1\x80\xd0\xbe\xd0\xb2\xd0\xba\xd0\xb0_RootKit.com_63k.txt" This comes from a filename: Расшифровка_RootKit.com_63k.txt My problem is a cannot reverse the first str to the…
Chocorean
  • 807
  • 1
  • 8
  • 25
4
votes
2 answers

Byte Stream vs Character Stream in Java

I am working on I/O classes in Java. I understand that there are two important type of streams: byte stream and character stream. But... I have tried to read and write text file with byte stream and it worked. Here is the code: File klasor = new…
user8177292
4
votes
2 answers

Creating pdf file from byte stream on Android

How can I save correctly a pdf file from http response on Android? byte stream is received through rest API. I tried this: try { File outputFile = new File("/storage/emulated/0/Android/data/package/files/", "cot.pdf"); FileOutpuStream fos = new…
dgama
  • 41
  • 1
  • 2
4
votes
2 answers

Display image of PNG binary that is stored in MongoDB

I have a mongodb collection that looks something like this: { u'_id': u'someid', u'files': {u'screenshot': Binary('\x89PNG\r\n\x1a\n\...', 0)} } The screenshot is in a binary format and I would like to display it. How would I do this in…
Stanko
  • 4,275
  • 3
  • 23
  • 51
4
votes
1 answer

How to read all bytes of a stream but the last 8

I have the following code: using (var fs = new FileStream(@"C:\dump.bin", FileMode.Create)) { income.CopyTo(fs); } income is a stream that I need to save to disk, the problem is that I want to ignore the last 8 bytes and save everything before…
user3900456
  • 2,003
  • 3
  • 25
  • 33
1
2 3
11 12