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