/** * Reads a sequence of geometries. * If an offset is specified, geometries read up to the offset count are skipped. * If a limit is specified, no more than <tt>limit</tt> geometries are read. * * @return the list of geometries read * @throws IOException if an I/O exception was encountered * @throws ParseException if an error occurred reading a geometry */ public List read() throws IOException, ParseException { // do this here so that constructors don't throw exceptions if (file != null) reader = new FileReader(file); count = 0; try { BufferedReader bufferedReader = new BufferedReader(reader); try { return read(bufferedReader); } finally { bufferedReader.close(); } } finally { reader.close(); } }
public static Geometry readWKBHexString(String wkb, GeometryFactory geomFact) throws ParseException, IOException { WKBReader reader = new WKBReader(geomFact); WKBHexFileReader fileReader = new WKBHexFileReader(new StringReader(wkb), reader); List geomList = fileReader.read(); if (geomList.size() == 1) return (Geometry) geomList.get(0); return geomFact.createGeometryCollection(GeometryFactory.toGeometryArray(geomList)); }