| Language \ Environment \ Comparison |

| Index

| The Processing 1.0 _ALPHA_ Reference is a work in progress. If you see any errors or have any comments, please write to: reas at groupc.net

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.
Syntax |  |
    loadBytes(filename);
Parameters |  |
filename |  | String: name of a file in the data folder or a url.
Returns |  | byte[]
Usage |  | Web & Application
Related |  | loadStream() loadStrings() saveStrings() saveBytes()

| © 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea |
| Processing is an open project initiated by Ben Fry and Casey Reas |