public DirectNIOBuffer(ByteBuffer buffer,boolean immutable) { super(immutable?IMMUTABLE:READWRITE,NON_VOLATILE); if (!buffer.isDirect()) throw new IllegalArgumentException(); _buf = buffer; setGetIndex(buffer.position()); setPutIndex(buffer.limit()); }
public DirectNIOBuffer(ByteBuffer buffer,boolean immutable) { super(immutable?IMMUTABLE:READWRITE,NON_VOLATILE); if (!buffer.isDirect()) throw new IllegalArgumentException(); _buf = buffer; setGetIndex(buffer.position()); setPutIndex(buffer.limit()); }
public DirectNIOBuffer(ByteBuffer buffer,boolean immutable) { super(immutable?IMMUTABLE:READWRITE,NON_VOLATILE); if (!buffer.isDirect()) throw new IllegalArgumentException(); _buf = buffer; setGetIndex(buffer.position()); setPutIndex(buffer.limit()); }
public DirectNIOBuffer(ByteBuffer buffer,boolean immutable) { super(immutable?IMMUTABLE:READWRITE,NON_VOLATILE); if (!buffer.isDirect()) throw new IllegalArgumentException(); _buf = buffer; setGetIndex(buffer.position()); setPutIndex(buffer.limit()); }
/** * @param file */ public DirectNIOBuffer(File file) throws IOException { super(READONLY,NON_VOLATILE); FileInputStream fis = null; FileChannel fc = null; try { fis = new FileInputStream(file); fc = fis.getChannel(); _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length()); setGetIndex(0); setPutIndex((int)file.length()); _access=IMMUTABLE; } finally { if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);} IO.close(fis); } }
/** * @param file */ public DirectNIOBuffer(File file) throws IOException { super(READONLY,NON_VOLATILE); FileInputStream fis = null; FileChannel fc = null; try { fis = new FileInputStream(file); fc = fis.getChannel(); _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length()); setGetIndex(0); setPutIndex((int)file.length()); _access=IMMUTABLE; } finally { if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);} IO.close(fis); } }
/** * @param file */ public DirectNIOBuffer(File file) throws IOException { super(READONLY,NON_VOLATILE); FileInputStream fis = null; FileChannel fc = null; try { fis = new FileInputStream(file); fc = fis.getChannel(); _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length()); setGetIndex(0); setPutIndex((int)file.length()); _access=IMMUTABLE; } finally { if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);} IO.close(fis); } }
/** * @param file */ public DirectNIOBuffer(File file) throws IOException { super(READONLY,NON_VOLATILE); FileInputStream fis = null; FileChannel fc = null; try { fis = new FileInputStream(file); fc = fis.getChannel(); _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length()); setGetIndex(0); setPutIndex((int)file.length()); _access=IMMUTABLE; } finally { if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);} IO.close(fis); } }
total += len; available -= len; setPutIndex(p); loop=0;
total += len; available -= len; setPutIndex(p); loop=0;
total += len; available -= len; setPutIndex(p); loop=0;
total += len; available -= len; setPutIndex(p); loop=0;