Code example for FileChannel

Methods: position, truncate

0
    @Override 
    public long truncate(long size) {
        checkClosed(); 
        checkWritable(); 
        try { 
            long oldPosition = fileChannel.position();
            fileChannel.truncate(size);
            // seek necessary on Windows only, see <http://bugs.python.org/issue801631> 
            fileChannel.position(oldPosition);
        } catch (IOException ioe) {
            throw Py.IOError(ioe);
        } 
        return size;
    } 
 
    @Override 
    public void close() { 
        if (closed()) { 
            return; 
        } 
        try {