public synchronized void close() throws IOException { try { if (delegate != null) { delegate.close(); } } catch (IOException e) { log.error("Failure to close delegate.", e); } delegate = null; if (reader != null) { try { reader.close(); } catch (Exception e) { log.warn("Failed to close reader", e); } finally { reader = null; } } closeWriter(); }
private BfPixelBuffer delegate() { if (isWrite()) { try { closeWriter(); try { initializeReader(); } catch (FormatException e) { throw new RuntimeException(e); } } catch (IOException e1) { throw new RuntimeException(e1); } } else if (delegate == null) { try { initializeReader(); } catch (IOException e) { throw new RuntimeException(e); } catch (FormatException e) { throw new RuntimeException(e); } } return delegate; }