What’s A Byte Stream, Anyway?

Byte streams are a sequence of bytes used by programs to input and output information. The terms byte stream and octet-stream are both used somewhat synonymously, though octet streams are common among networking terminology.

Image by Overcoded

Bits vs. Bytes

Image by Overcoded

Byte Stream

Image by Overcoded

Byte Stream Example in Java

// Define I/O streamsFileInputStream inStream;FileOutputStream outStream;// Get input streaminStream = new FileInputStream("input.txt");// Get output StreamoutStream = new FileOutputStream("output.txt");// Stream input, write to outputint next;  // the next character in the byte streamwhile((next = inStream.read()) != -1){    // Write next character    outStream.write(next);}


Entrepreneur, Computer Science Student, Designer, and self-confessed health nut that enjoys productivity hacks, developing better habits, and Mother Nature.