/** * @see java.io.RandomAccessFile#close() * Cleans the mapped bytebuffers and closes the channel */ public void close() throws java.io.IOException { clean(byteBuffer); }
/** * {@inheritDoc} */ public void close() throws java.io.IOException { if (source == null) return; source.close(); source = null; }
/** * {@inheritDoc} */ public int get(long position) throws java.io.IOException { if (source == null) throw new java.io.IOException("RandomAccessSource not opened"); return source.get(position); }
/** * Map the region of the channel * @throws java.io.IOException if there is a problem with creating the map */ void open() throws java.io.IOException { if (source != null) return; if (!channel.isOpen()) throw new IllegalStateException("Channel is closed"); source = new ByteBufferRandomAccessSource(channel.map(FileChannel.MapMode.READ_ONLY, offset, length)); }
/** * {@inheritDoc} */ public int get(long position, byte[] bytes, int off, int len) throws java.io.IOException { if (source == null) throw new java.io.IOException("RandomAccessSource not opened"); return source.get(position, bytes, off, len); }
/** * Map the region of the channel * @throws java.io.IOException if there is a problem with creating the map */ void open() throws java.io.IOException { if (source != null) return; if (!channel.isOpen()) throw new IllegalStateException("Channel is closed"); source = new ByteBufferRandomAccessSource(channel.map(FileChannel.MapMode.READ_ONLY, offset, length)); }
/** * {@inheritDoc} */ public int get(long position) throws java.io.IOException { if (source == null) throw new java.io.IOException("RandomAccessSource not opened"); return source.get(position); }
/** * {@inheritDoc} */ public void close() throws java.io.IOException { if (source == null) return; source.close(); source = null; }
/** * @see java.io.RandomAccessFile#close() * Cleans the mapped bytebuffers and closes the channel */ public void close() throws java.io.IOException { clean(byteBuffer); }
/** * {@inheritDoc} */ public int get(long position, byte[] bytes, int off, int len) throws java.io.IOException { if (source == null) throw new java.io.IOException("RandomAccessSource not opened"); return source.get(position, bytes, off, len); }