MCPcopy Index your code
hub / github.com/processing/processing / loadBytesRaw

Method loadBytesRaw

app/src/processing/app/Util.java:53–66  ·  view source on GitHub ↗

Same as PApplet.loadBytes(), however never does gzip decoding.

(File file)

Source from the content-addressed store, hash-verified

51 * Same as PApplet.loadBytes(), however never does gzip decoding.
52 */
53 static public byte[] loadBytesRaw(File file) throws IOException {
54 int size = (int) file.length();
55 FileInputStream input = new FileInputStream(file);
56 byte buffer[] = new byte[size];
57 int offset = 0;
58 int bytesRead;
59 while ((bytesRead = input.read(buffer, offset, size-offset)) != -1) {
60 offset += bytesRead;
61 if (bytesRead == 0) break;
62 }
63 input.close(); // weren't properly being closed
64 input = null;
65 return buffer;
66 }
67
68
69 /**

Callers 1

buildZipMethod · 0.95

Calls 2

readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected