File spatial4j-jts18.patch of Package spatial4j
--- spatial4j-spatial4j-0.8/src/main/java/org/locationtech/spatial4j/io/jts/JtsBinaryCodec.java 2020-11-25 23:07:51.000000000 +0100
+++ spatial4j-spatial4j-0.8/src/main/java/org/locationtech/spatial4j/io/jts/JtsBinaryCodec.java 2022-03-08 08:21:08.010184781 +0100
@@ -85,15 +85,17 @@
InStream inStream = new InStream() {//a strange JTS abstraction
boolean first = true;
@Override
- public void read(byte[] buf) throws IOException {
+ public int read(byte[] buf) throws IOException {
if (first) {//we don't write JTS's leading BOM so synthesize reading it
if (buf.length != 1)
throw new IllegalStateException("Expected initial read of one byte, not: " + buf.length);
buf[0] = WKBConstants.wkbXDR;//0
first = false;
+ return 1;
} else {
//TODO for performance, specialize for common array lengths: 1, 4, 8
dataInput.readFully(buf);
+ return buf.length;
}
}
};