/** * Returns a write-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; } }
/** * Returns a read-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, O_RDONLY); } return channel; } }
/** * Gets this file's {@link FileChannel} object. * <p> * The file channel's {@link FileChannel#position() position} is the same * as this file's file pointer offset (see {@link #getFilePointer()}). Any * changes made to this file's file pointer offset are also visible in the * file channel's position and vice versa. * * @return this file's file channel instance. */ public final synchronized FileChannel getChannel() { if(channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; }
/** * Constructs a new {@code FileOutputStream} that writes to {@code fd}. * * @throws NullPointerException if {@code fd} is null. */ public FileOutputStream(FileDescriptor fd) { if (fd == null) { throw new NullPointerException("fd == null"); } this.fd = fd; this.shouldClose = false; this.mode = O_WRONLY; this.channel = NioUtils.newFileChannel(this, fd, mode); // Note that we do not call guard.open here because the // FileDescriptor is not owned by the stream. }
/** * Returns a write-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; } }
/** * Returns a read-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, O_RDONLY); } return channel; } }
/** * Returns a read-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, O_RDONLY); } return channel; } }
/** * Returns a read-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, O_RDONLY); } return channel; } }
/** * Returns a read-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, O_RDONLY); } return channel; } }
/** * Returns a read-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, O_RDONLY); } return channel; } }
/** * Returns a write-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; } }
/** * Returns a write-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; } }
/** * Returns a write-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; } }
/** * Returns a write-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; } }
/** * Returns a read-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, O_RDONLY); } return channel; } }
/** * Returns a write-only {@link FileChannel} that shares its position with * this stream. */ public FileChannel getChannel() { synchronized (this) { if (channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; } }
/** * Gets this file's {@link FileChannel} object. * <p> * The file channel's {@link FileChannel#position() position} is the same * as this file's file pointer offset (see {@link #getFilePointer()}). Any * changes made to this file's file pointer offset are also visible in the * file channel's position and vice versa. * * @return this file's file channel instance. */ public final synchronized FileChannel getChannel() { if(channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; }
/** * Gets this file's {@link FileChannel} object. * <p> * The file channel's {@link FileChannel#position() position} is the same * as this file's file pointer offset (see {@link #getFilePointer()}). Any * changes made to this file's file pointer offset are also visible in the * file channel's position and vice versa. * * @return this file's file channel instance. */ public final synchronized FileChannel getChannel() { if(channel == null) { channel = NioUtils.newFileChannel(this, fd, mode); } return channel; }
/** * Constructs a new {@code FileOutputStream} that writes to {@code fd}. * * @throws NullPointerException if {@code fd} is null. */ public FileOutputStream(FileDescriptor fd) { if (fd == null) { throw new NullPointerException("fd == null"); } this.fd = fd; this.shouldClose = false; this.mode = O_WRONLY; this.channel = NioUtils.newFileChannel(this, fd, mode); // Note that we do not call guard.open here because the // FileDescriptor is not owned by the stream. }
/** * Constructs a new {@code FileOutputStream} that writes to {@code fd}. * * @throws NullPointerException if {@code fd} is null. */ public FileOutputStream(FileDescriptor fd) { if (fd == null) { throw new NullPointerException("fd == null"); } this.fd = fd; this.shouldClose = false; this.mode = O_WRONLY; this.channel = NioUtils.newFileChannel(this, fd, mode); // Note that we do not call guard.open here because the // FileDescriptor is not owned by the stream. }