a port of the Processing Visualization Language
Name

loadBytes()

Examples
// open a file and read its binary data 
byte b[] = loadBytes("something.dat"); 
 
// print each value, from 0 to 255 
for (int i = 0; i < b.length; i++) { 
  // every tenth number, start a new line 
  if ((i % 10) == 0) { 
    println(); 
  } 
 
  // bytes are from -128 to 127, this converts to 0 to 255 
  int a = b[i] & 0xff; 
  print(a + " "); 
} 
// print a blank line at the end 
println();
Description

Reads the contents of a file or url and places it in a byte array. If a file is specified, it must be located in the sketch's "data" directory/folder.

The filename parameter can also be a URL to a file found online. For security reasons, a Processing sketch found online can only download files from the same server from which it came.

Syntax
loadBytes(filename)
Parameters
filename String: name of file in the data folder or a URL
Returns byte[]
Usage Web & Application
Related loadStrings()
saveStrings()
saveBytes()

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub