Code example for FileDescriptor

0
    @Override public SourceChannel source() {
        return source;
    } 
 
    /** 
     * FileChannelImpl doesn't close its fd itself; it calls close on the object it's given. 
     */ 
    private static class FdCloser implements Closeable {
        private final FileDescriptor fd;
        private FdCloser(FileDescriptor fd) {
            this.fd = fd;
        } 
        public void close() throws IOException { 
            IoUtils.close(fd);
        } 
    } 
 
    private class PipeSourceChannel extends Pipe.SourceChannel implements FileDescriptorHandler {
        private final FileDescriptor fd;
        private final FileChannelImpl channel;