I'm making some quirky project with corrupted JPG files.
I can't seem catch this error the traditional way:
- try {
- byte b[] = loadBytes("poop"+k+".jpg");
- int r = round(random(0, b.length-1));
- b[r] = (byte)binaryswap(binary(b[r]));
- k++;
- saveBytes(dataPath("poop"+k+".jpg"), b);
- b = null;
- }
- catch (Exception e) {
- println("We went too far Jack, he's done for!");
- }
...Doesn't ever enter the Exception branch, although the following is displayed in the console:
- Corrupt JPEG data: bad Huffman code
... or...
- Corrupt JPEG data: premature end of data segment
I'm working with corrupt files, actually they are being corrupted by the program. I want to know when they get corrupted so I can act on it... but how do I catch the error?
1