Rrjedhat e biteve përdoren për të kryer veprime input dhe output me 8 bite. Ka disa klasa që lidhen me rrjedhat e biteve, por klasat më të përdorura janë: FileInputStream dhe FileOutputStream.
Shembull:
Në këtë shembull përdoren dy klasa për të kopjuar një skedar Input në një tjetër skedar output
import java.io.*;
public class CopyFile {
public static void main(String args[]) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("input.txt");
out = new FileOutputStream("output.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
}
finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}