// 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() throws IOException { if (streamEnded || streamPaused()) ret -1; int b = in.read(); if (b >= 0) ++position; else set streamEnded; ret b; } public void setCutOffPoint(long point) { cutOffPoint = point; } public bool streamPaused() { ret position >= cutOffPoint; } public bool streamEnded() { ret streamEnded; } public void incCutOffPoint(long bytes) { cutOffPoint += bytes; } }