Code example for FileDescriptor

    @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 { 
    private class PipeSourceChannel extends Pipe.SourceChannel implements FileDescriptorHandler {
        private final FileDescriptor fd;
        private final FileChannelImpl channel;
Experience pair programming with AI  Get Codota for Java