Hi All,
Sorry if this isn't the right place for JTS bugs, but I can't find an issue
tracker at Vivid Solutions, and I don't have an account for the Jira
tracker.
The InputStreamInStream class has a bug that will cause WkbReader to fail
when the underlying stream doesn't always completely fill the buffer when
InputStream.read(byte[]) is called -- it's not required to if the bytes are
not immediately available.
I've encountered the bug when the underlying stream is a GZIPInputStream or
a URLInputStream.
This implementation is correct:
private static class InputStreamInStream implements InStream {
private InputStream in;
public InputStreamInStream(InputStream in) {
super();
this.in = in;
}
@Override
public void read(byte[] buf) throws IOException {
int n = 0;
while (n < buf.length) {
int count = in.read(buf, n, buf.length - n);
if (count < 0) {
throw new EOFException();
}
n += count;
}
}
}
Best,
Alex Bertram
bedatadriven
------------------------------------------------------------------------------
WINDOWS 8 is here.
Millions of people. Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel