/** Creates a new read-only byte-buffer input stream by mapping a given file channel. * * @param fileChannel the file channel that will be mapped. * @return a new read-only byte-buffer input stream over the contents of <code>fileChannel</code>. */ public static ByteBufferInputStream map( final FileChannel fileChannel ) throws IOException { return map( fileChannel, MapMode.READ_ONLY ); }
/** Creates a new read-only byte-buffer input stream by mapping a given file channel. * * @param fileChannel the file channel that will be mapped. * @return a new read-only byte-buffer input stream over the contents of <code>fileChannel</code>. */ public static ByteBufferInputStream map( final FileChannel fileChannel ) throws IOException { return map( fileChannel, MapMode.READ_ONLY ); }
/** Creates a new read-only byte-buffer input stream by mapping a given file channel. * * @param fileChannel the file channel that will be mapped. * @return a new read-only byte-buffer input stream over the contents of <code>fileChannel</code>. */ public static ByteBufferInputStream map( final FileChannel fileChannel ) throws IOException { return map( fileChannel, MapMode.READ_ONLY ); }
public void reload() throws IOException { RandomAccessFile newRAF = new RandomAccessFile(file, "r"); RandomAccessFile oldRAF = raf; FileChannel newFc = newRAF.getChannel(); ByteBufferInputStream newBbis = ByteBufferInputStream.map(newFc); synchronized(this) { bbis = newBbis; raf = newRAF; } if (oldRAF != null) { oldRAF.close(); } }
public void reload() throws IOException { RandomAccessFile newRAF = new RandomAccessFile(file, "r"); RandomAccessFile oldRAF = raf; FileChannel newFc = newRAF.getChannel(); ByteBufferInputStream newBbis = ByteBufferInputStream.map(newFc); synchronized(this) { bbis = newBbis; raf = newRAF; } if (oldRAF != null) { oldRAF.close(); } }
public void reload() throws IOException { RandomAccessFile newRAF = new RandomAccessFile(file, "r"); RandomAccessFile oldRAF = raf; FileChannel newFc = newRAF.getChannel(); ByteBufferInputStream newBbis = ByteBufferInputStream.map(newFc); synchronized(this) { bbis = newBbis; raf = newRAF; } if (oldRAF != null) { oldRAF.close(); } }