@Override public FileChannel open(String mode) { FileNioMemData obj = getMemoryFile(); return new FileNioMem(obj, "r".equals(mode)); }
@Override public FileChannel truncate(long newLength) throws IOException { // compatibility with JDK FileChannel#truncate if (readOnly) { throw new NonWritableChannelException(); } if (newLength < size()) { data.touch(readOnly); pos = Math.min(pos, newLength); data.truncate(newLength); } return this; }
@Override public OutputStream newOutputStream(boolean append) throws IOException { FileNioMemData obj = getMemoryFile(); FileNioMem m = new FileNioMem(obj, false); return new FileChannelOutputStream(m, append); }
@Override public InputStream newInputStream() { FileNioMemData obj = getMemoryFile(); FileNioMem m = new FileNioMem(obj, true); return new FileChannelInputStream(m, true); }