@Nullable public static Envelope deserializeEnvelope(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); int length = input.available() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return getEnvelope(input, type, length); }
public static OGCGeometry deserialize(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); int length = input.available() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return readGeometry(input, shape, type, length); }
private static Geometry readGeometryCollection(BasicSliceInput input) { List<Geometry> geometries = new ArrayList<>(); while (input.available() > 0) { // skip length input.readInt(); GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); geometries.add(readGeometry(input, type)); } return GEOMETRY_FACTORY.createGeometryCollection(geometries.toArray(new Geometry[0])); }
public static GeometrySerializationType deserializeType(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); return GeometrySerializationType.getForCode(input.readByte()); }
private static OGCConcreteGeometryCollection readGeometryCollection(BasicSliceInput input, Slice inputSlice) { // GeometryCollection: geometryType|len-of-shape1|bytes-of-shape1|len-of-shape2|bytes-of-shape2... List<OGCGeometry> geometries = new ArrayList<>(); while (input.available() > 0) { int length = input.readInt() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); geometries.add(readGeometry(input, inputSlice, type, length)); } return new OGCConcreteGeometryCollection(geometries, null); }
public static Geometry deserialize(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return readGeometry(input, type); }
private static Envelope getGeometryCollectionOverallEnvelope(BasicSliceInput input) { Envelope overallEnvelope = null; while (input.available() > 0) { int length = input.readInt() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); Envelope envelope = getEnvelope(input, type, length); overallEnvelope = merge(overallEnvelope, envelope); } return overallEnvelope; }
Slice slice = slicesIterator.next(); if (slice.getInput().available() == 0) { continue;
@Override public int available() throws IOException { return sliceInput.available(); }
Slice slice = GEOMETRY.getSlice(input, i); if (slice.getInput().available() == 0) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_LineString: null point at index %s", i + 1));
@Override public long skip(long length) { length = Math.min(length, available()); position += length; return length; }
@Override public int skipBytes(int length) { length = Math.min(length, available()); position += length; return length; }
@Override public int skipBytes(int length) { length = Math.min(length, available()); position += length; return length; }
/** * Decodes this buffer's readable bytes into a string with the specified * character set name. This method is identical to * {@code buf.toString(buf.position(), buf.available()(), charsetName)}. * This method does not modify {@code position} or {@code writerIndex} of * this buffer. */ public String toString(Charset charset) { return slice.toString(position, available(), charset); }
@Nullable public static Envelope deserializeEnvelope(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); int length = input.available() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return getEnvelope(input, type, length); }
@Nullable public static Envelope deserializeEnvelope(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); int length = input.available() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return getEnvelope(input, type, length); }
public static OGCGeometry deserialize(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); int length = input.available() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return readGeometry(input, shape, type, length); }
private static OGCConcreteGeometryCollection readGeometryCollection(BasicSliceInput input, Slice inputSlice) { // GeometryCollection: geometryType|len-of-shape1|bytes-of-shape1|len-of-shape2|bytes-of-shape2... List<OGCGeometry> geometries = new ArrayList<>(); while (input.available() > 0) { int length = input.readInt() - 1; GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); geometries.add(readGeometry(input, inputSlice, type, length)); } return new OGCConcreteGeometryCollection(geometries, null); }
public static Geometry deserialize(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return readGeometry(input, type); }
public static Geometry deserialize(Slice shape) { requireNonNull(shape, "shape is null"); BasicSliceInput input = shape.getInput(); verify(input.available() > 0); GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte()); return readGeometry(input, type); }