in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/soap/FileContents.java [115:150]
public InputStream getInputStream() throws IOException {
final File f = this.f;
return new InputStream() {
private int idx;
@Override
public int read(byte[] b, int off, int len) throws IOException {
byte[] r;
try {
r = f.getContents(idx, len);
} catch (FilesystemAccessException e) {
throw new IOException(e);
}
if (r == null)
return -1;
len = min(len, r.length);
arraycopy(r, 0, b, off, len);
idx += len;
return len;
}
@Override
public int read() throws IOException {
byte[] r;
try {
r = f.getContents(idx, 1);
} catch (FilesystemAccessException e) {
throw new IOException(e);
}
if (r == null)
return -1;
idx++;
return r[0];
}
};
}