public String getPath() { return reader == null ? null : reader.getPath(); }
public String getPath() { return reader == null ? null : reader.getPath(); }
public void close() { try { seekableStream.close(); } catch (IOException e) { log.error("Error closing reader for: " + getPath(), e); } }
public void close() { try { seekableStream.close(); } catch (IOException e) { log.error("Error closing reader for: " + getPath(), e); } }
private Double getValue(WindowFunction wf) { if (!valueCache.containsKey(wf)) { TDFGroup rootGroup = getGroup("/"); String maxString = rootGroup.getAttribute(wf.getValue()); try { valueCache.put(wf, Double.parseDouble(maxString)); } catch (Exception e) { log.info("Warning: value '" + wf.toString() + "' not found in tdf value " + getPath()); valueCache.put(wf, null); } } return valueCache.get(wf); }
private Double getValue(WindowFunction wf) { if (!valueCache.containsKey(wf)) { TDFGroup rootGroup = getGroup("/"); String maxString = rootGroup.getAttribute(wf.getDisplayName()); try { valueCache.put(wf, Double.parseDouble(maxString)); } catch (Exception e) { log.info("Warning: value '" + wf.toString() + "' not found in tdf value " + getPath()); valueCache.put(wf, null); } } return valueCache.get(wf); }
log.error("BufferUnderflowException. path=" + getPath() + " idxPosition=" + idxPosition + " nBytes=" + nBytes); throw e;
private void readMasterIndex(long idxPosition, int nBytes) throws IOException { try { //fis.seek(idxPosition); //byte[] bytes = new byte[nBytes]; //readFully(bytes); byte[] bytes = readBytes(idxPosition, nBytes); ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); byteBuffer.order(ByteOrder.LITTLE_ENDIAN); int nDatasets = byteBuffer.getInt(); datasetIndex = new LinkedHashMap(nDatasets); for (int i = 0; i < nDatasets; i++) { String name = StringUtils.readString(byteBuffer); long fPosition = byteBuffer.getLong(); int n = byteBuffer.getInt(); datasetIndex.put(name, new IndexEntry(fPosition, n)); } int nGroups = byteBuffer.getInt(); groupIndex = new LinkedHashMap(nGroups); for (int i = 0; i < nGroups; i++) { String name = StringUtils.readString(byteBuffer); long fPosition = byteBuffer.getLong(); int n = byteBuffer.getInt(); groupIndex.put(name, new IndexEntry(fPosition, n)); } } catch (BufferUnderflowException e) { // We intermittently see this exception in this method. Log as much info as possible log.error("BufferUnderflowException. path=" + getPath() + " idxPosition=" + idxPosition + " nBytes=" + nBytes); throw e; } }
public synchronized TDFDataset getDataset(String name) { if (datasetCache.containsKey(name)) { return datasetCache.get(name); } try { if (datasetIndex.containsKey(name)) { IndexEntry ie = datasetIndex.get(name); long position = ie.position; int nBytes = ie.nBytes; //fis.seek(position); //byte[] buffer = new byte[nBytes]; //readFully(buffer); byte[] buffer = readBytes(position, nBytes); ByteBuffer byteBuffer = ByteBuffer.wrap(buffer); byteBuffer.order(ByteOrder.LITTLE_ENDIAN); TDFDataset ds = new TDFDataset(name, byteBuffer, this); datasetCache.put(name, ds); return ds; } else { datasetCache.put(name, null); return null; } } catch (IOException ex) { log.error("Error reading dataset: " + getPath() + " (" + name + ")", ex); throw new RuntimeException("System error occured while reading dataset: " + name); } }