// InputStream you can cut off at a certain byte // (to test streaming input) sclass SimulatedPartialInputStream { InputStream in; long position, cutOffPoint; *(InputStream *in) {} public int read() { if (position >= cutOffPoint) ret -1; in b = in.read(); if (b >= 0) ++position; ret b; } }