public PointFeatureIterator getPointFeatureIterator(int bufferSize) throws IOException { String query = PointDatasetRemote.makeQuery("stn=" + s.getName(), null, dateRange); InputStream in = null; try { in = CdmRemote.sendQuery(uri, query); PointStream.MessageType mtype = PointStream.readMagic(in); if (mtype == PointStream.MessageType.End) { // no obs were found in.close(); return new PointIteratorEmpty(); // return empty iterator } if (mtype != PointStream.MessageType.PointFeatureCollection) { throw new RuntimeException("Station Request: bad response = " + mtype); } int len = NcStream.readVInt(in); byte[] b = new byte[len]; NcStream.readFully(in, b); PointStreamProto.PointFeatureCollection pfc = PointStreamProto.PointFeatureCollection.parseFrom(b); riter = new RemotePointFeatureIterator(in, new PointStream.ProtobufPointFeatureMaker(pfc)); riter.setCalculateBounds(this); return riter; } catch (Throwable t) { if (in != null) in.close(); throw new IOException(t.getMessage(), t); } } }
@Override public PointFeatureIterator getPointFeatureIterator(int bufferSize) throws IOException { String query = PointDatasetRemote.makeQuery("stn=" + s.getName(), null, dateRange); InputStream in = null; try { in = CdmRemote.sendQuery(uri, query); PointStream.MessageType mtype = PointStream.readMagic(in); if (mtype == PointStream.MessageType.End) { // no obs were found in.close(); return new PointIteratorEmpty(); // return empty iterator } if (mtype != PointStream.MessageType.PointFeatureCollection) { throw new RuntimeException("Station Request: bad response = " + mtype); } int len = NcStream.readVInt(in); byte[] b = new byte[len]; NcStream.readFully(in, b); PointStreamProto.PointFeatureCollection pfc = PointStreamProto.PointFeatureCollection.parseFrom(b); riter = new RemotePointFeatureIterator(in, new PointStream.ProtobufPointFeatureMaker(pfc)); riter.setCalculateBounds(this); return riter; } catch (Throwable t) { if (in != null) in.close(); throw new IOException(t.getMessage(), t); } } }
@Override public PointFeatureIterator getPointFeatureIterator() throws IOException { String query = PointDatasetRemote.makeQuery("stn=" + s.getName(), null, getInfo().getCalendarDateRange(this.getTimeUnit())); InputStream in = null; try { in = CdmRemote.sendQuery(null, uri, query); PointStream.MessageType mtype = PointStream.readMagic(in); if (mtype == PointStream.MessageType.End) { // no obs were found in.close(); return new PointIteratorEmpty(); // return empty iterator } if (mtype != PointStream.MessageType.PointFeatureCollection) { throw new RuntimeException("Station Request: bad response = " + mtype); } int len = NcStream.readVInt(in); byte[] b = new byte[len]; NcStream.readFully(in, b); PointStreamProto.PointFeatureCollection pfc = PointStreamProto.PointFeatureCollection.parseFrom(b); riter = new PointIteratorStream(StationFeatureStream.this, in, new PointStream.ProtobufPointFeatureMaker(pfc)); return riter; } catch (Throwable t) { if (in != null) in.close(); throw new IOException(t.getMessage(), t); } } }
return iter; } else if (mtype == PointStream.MessageType.End) { return new PointIteratorEmpty(); // nothing in the iteration } else if (mtype == PointStream.MessageType.Error) { int len = NcStream.readVInt(in);
return new PointIteratorEmpty(); // nothing in the iteration
return new PointIteratorEmpty(); // nothing in the iteration