@Override public void close() throws IOException { if (isClosed) { throw new IOException(); } isClosed = true; }
@Override public byte[] loadFile( final Path file ) throws FileException { if (!isActive()) { return new byte[0]; } checkNotNull( "file", file ); try { return getIOService().readAllBytes( file ); } catch ( IOException ex ) { throw new FileException( ex.getMessage(), ex ); } }
@Override public byte[] loadFile(Path file) throws FileException { checkNotNull( "file", file ); try { return ioService.readAllBytes( file ); } catch ( IOException ex ) { throw new FileException( ex.getMessage(), ex ); } }
@Override public void close() throws IOException { if (isClosed) { throw new IOException("This stream is closed."); } isClosed = true; }
@Override public void close() throws IOException { if (isClosed) { throw new IOException("This stream is closed."); } isClosed = true; }
@Override public SeekableByteChannel truncate(final long size) throws IOException { try { channel.truncate(size); return this; } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public void close() throws java.io.IOException { try { channel.close(); } catch (java.io.IOException e) { throw new IOException(e); } } }
@Override public long position() throws IOException { try { return channel.position(); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public long size() throws IOException { try { return channel.size(); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public int read(final ByteBuffer dst) throws java.io.IOException { try { return channel.read(dst); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public SeekableByteChannel position(final long newPosition) throws IOException { try { channel.position(newPosition); return this; } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public int write(final ByteBuffer src) throws java.io.IOException { try { return channel.write(src); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public long position() throws IOException { try { return channel.position(); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public SeekableByteChannel position(final long newPosition) throws IOException { try { channel.position(newPosition); return this; } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public SeekableByteChannel truncate(final long size) throws IOException { try { channel.truncate(size); return this; } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public int read(final ByteBuffer dst) throws java.io.IOException { try { return channel.read(dst); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public int write(final ByteBuffer src) throws java.io.IOException { try { return channel.write(src); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public long size() throws IOException { try { return channel.size(); } catch (java.io.IOException e) { throw new IOException(e); } }
@Override public void close() throws java.io.IOException { try { channel.close(); } catch (java.io.IOException e) { throw new IOException(e); } } }
private static long internalCopy(InputStream in, OutputStream out) { long read = 0L; byte[] buf = new byte[BUFFER_SIZE]; int n; try { while ((n = in.read(buf)) > 0) { out.write(buf, 0, n); read += n; } } catch (java.io.IOException e) { throw new IOException(e); } return read; }