Same as PApplet.loadBytes(), however never does gzip decoding.
(File file)
| 2219 | * Same as PApplet.loadBytes(), however never does gzip decoding. |
| 2220 | */ |
| 2221 | static public byte[] loadBytesRaw(File file) throws IOException { |
| 2222 | int size = (int) file.length(); |
| 2223 | FileInputStream input = null; |
| 2224 | try { |
| 2225 | input = new FileInputStream(file); |
| 2226 | byte buffer[] = new byte[size]; |
| 2227 | int offset = 0; |
| 2228 | int bytesRead; |
| 2229 | while ((bytesRead = input.read(buffer, offset, size - offset)) != -1) { |
| 2230 | offset += bytesRead; |
| 2231 | if (bytesRead == 0) break; |
| 2232 | } |
| 2233 | return buffer; |
| 2234 | } finally { |
| 2235 | IOUtils.closeQuietly(input); |
| 2236 | } |
| 2237 | } |
| 2238 | |
| 2239 | |
| 2240 | /** |