Searched refs:channel (Results 1 - 25 of 29) sorted by relevance

12

/libcore/luni/src/main/java/java/nio/channels/
H A DChannels.java42 * Returns an input stream on the given channel. The resulting stream has
45 * <li>If the stream is closed, then the underlying channel is closed as
48 * <li>It throws an {@link IllegalBlockingModeException} if the channel is
54 * @param channel
55 * the channel to be wrapped by an InputStream.
56 * @return an InputStream that takes bytes from the given byte channel.
58 public static InputStream newInputStream(ReadableByteChannel channel) { argument
59 return new ChannelInputStream(channel);
63 * Returns an output stream on the given channel. The resulting stream has
66 * <li>If the stream is closed, then the underlying channel i
78 newOutputStream(WritableByteChannel channel) argument
129 newReader(ReadableByteChannel channel, CharsetDecoder decoder, int minBufferCapacity) argument
150 newReader(ReadableByteChannel channel, String charsetName) argument
171 newWriter(WritableByteChannel channel, CharsetEncoder encoder, int minBufferCapacity) argument
193 newWriter(WritableByteChannel channel, String charsetName) argument
206 private final ReadableByteChannel channel; field in class:Channels.ChannelInputStream
208 ChannelInputStream(ReadableByteChannel channel) argument
246 private final WritableByteChannel channel; field in class:Channels.ChannelOutputStream
248 ChannelOutputStream(WritableByteChannel channel) argument
277 checkBlocking(Channel channel) argument
[all...]
H A DFileLock.java44 * closing the channel or exiting the process (terminating the VM).
62 * memory-mapped. On some platforms, closing a channel on a given file handle
65 * option here is to ensure that you only acquire locks on a single channel for
73 // The underlying file channel.
74 private final FileChannel channel; field in class:FileLock
86 * Constructs a new file lock instance for a given channel. The constructor
89 * @param channel
90 * the underlying file channel that holds the lock.
99 protected FileLock(FileChannel channel, long position, long size, boolean shared) { argument
103 this.channel
114 public final FileChannel channel() { method in class:FileLock
[all...]
H A DSelectionKey.java20 * A {@code SelectionKey} represents the relationship between a channel and a
21 * selector for which the channel is registered.
24 * set represent categories of operations for a key's channel: Accepting socket
29 * {@link SelectableChannel channel} is interested in performing.
32 * {@code channel} is ready to execute.
106 * Gets the channel of this key.
108 * @return the channel of this key.
110 public abstract SelectableChannel channel(); method in class:SelectionKey
114 * only those bits set that are valid for this key's channel.
131 * key's channel
[all...]
/libcore/luni/src/main/java/java/nio/
H A DSelectionKeyImpl.java32 private AbstractSelectableChannel channel; field in class:SelectionKeyImpl
40 public SelectionKeyImpl(AbstractSelectableChannel channel, int operations, argument
42 this.channel = channel;
49 public SelectableChannel channel() { method in class:SelectionKeyImpl
50 return channel;
70 if ((operations & ~(channel().validOps())) != 0) {
106 * Returns true if the channel for this key is connected. If the channel
110 return !(channel instanceo
[all...]
H A DPipeImpl.java62 private final SocketChannel channel; field in class:PipeImpl.PipeSourceChannel
67 this.channel = new SocketChannelImpl(selectorProvider, fd);
71 channel.close();
79 return channel.read(buffer);
83 return channel.read(buffers);
87 return channel.read(buffers, offset, length);
97 private final SocketChannel channel; field in class:PipeImpl.PipeSinkChannel
102 this.channel = new SocketChannelImpl(selectorProvider, fd);
106 channel.close();
114 return channel
[all...]
H A DSocketChannelImpl.java90 * Constructor for creating a connected socket channel.
97 * Constructor for creating an optionally connected socket channel.
486 private final SocketChannelImpl channel; field in class:SocketChannelImpl.SocketAdapter
489 SocketAdapter(PlainSocketImpl socketImpl, SocketChannelImpl channel) throws SocketException { argument
492 this.channel = channel;
502 return channel;
507 return channel.isBound;
512 return channel.isConnected();
518 return channel
604 private final SocketChannel channel; field in class:SocketChannelImpl.SocketChannelOutputStream
606 SocketChannelOutputStream(SocketChannel channel) argument
647 private final SocketChannel channel; field in class:SocketChannelImpl.SocketChannelInputStream
649 SocketChannelInputStream(SocketChannel channel) argument
[all...]
H A DSelectorImpl.java119 @Override protected SelectionKey register(AbstractSelectableChannel channel, argument
121 if (!provider().equals(channel.provider())) {
126 SelectionKeyImpl selectionKey = new SelectionKeyImpl(channel, operations,
218 setPollFd(i++, ((FileDescriptorChannel) key.channel()).getFD(), eventMask, key);
H A DFileChannelImpl.java61 * Create a new file channel implementation class that wraps the given
140 public FileLockImpl(FileChannel channel, long position, long size, boolean shared) { argument
141 super(channel, position, size, shared);
145 return !isReleased && channel().isOpen();
149 if (!channel().isOpen()) {
153 ((FileChannelImpl) channel()).release(this);
181 * Non-API method to release a given lock on a file channel. Assumes that
/libcore/luni/src/main/java/java/io/
H A DFileOutputStream.java58 /** The unique file channel. Lazily initialized because it's rarely needed. */
59 private FileChannel channel; field in class:FileOutputStream
105 this.channel = NioUtils.newFileChannel(this, fd, mode);
135 if (channel != null) {
136 channel.close();
171 if (channel == null) {
172 channel = NioUtils.newFileChannel(this, fd, mode);
174 return channel;
H A DFileInputStream.java61 /** The unique file channel. Lazily initialized because it's rarely needed. */
62 private FileChannel channel; field in class:FileInputStream
117 if (channel != null) {
118 channel.close();
160 if (channel == null) {
161 channel = NioUtils.newFileChannel(this, fd, O_RDONLY);
163 return channel;
H A DRandomAccessFile.java50 // The unique file channel associated with this FileInputStream (lazily
52 private FileChannel channel; field in class:RandomAccessFile
162 if (channel != null && channel.isOpen()) {
163 channel.close();
164 channel = null;
184 * The file channel's {@link FileChannel#position() position} is the same
187 * file channel's position and vice versa.
189 * @return this file's file channel instance.
192 if(channel
[all...]
/libcore/luni/src/test/java/libcore/java/io/
H A DOldFileInputStreamTest.java105 FileChannel channel;
113 channel = fis.getChannel();
114 assertNotNull(channel);
115 assertTrue("Channel is closed.", channel.isOpen());
117 // Check that the channel is associated with the input stream.
118 channel.position(offset);
127 assertFalse("Channel has not been closed.", channel.isOpen());
H A DInterruptedStreamTest.java142 private void testInterruptReadableChannel(final ReadableByteChannel channel) throws Exception { argument
145 channel.read(ByteBuffer.allocate(BUFFER_SIZE));
179 private void testInterruptWritableChannel(final WritableByteChannel channel) throws Exception { argument
184 channel.write(ByteBuffer.allocate(BUFFER_SIZE));
/libcore/luni/src/test/java/libcore/java/nio/channels/
H A DOldServerSocketChannelTest.java66 ServerSocketChannel channel =
68 assertNotNull(channel);
69 assertSame(SelectorProvider.provider(),channel.provider());
H A DOldSocketChannelTest.java92 SocketChannel channel =
94 assertNotNull(channel);
95 assertSame(SelectorProvider.provider(), channel.provider());
96 channel = SocketChannel.open();
97 assertNotNull(channel);
98 assertSame(SelectorProvider.provider(), channel.provider());
266 // if the channel could not finish writing in TIMEOUT ms, the
H A DOldFileChannelTest.java503 private void doTestForIOOBException(FileChannel channel, argument
506 channel.read(buffer, -1, 0);
512 channel.read(buffer, 0, -1);
518 channel.read(buffer, 0, 3);
524 channel.read(buffer, 1, 2);
530 channel.read(buffer, 2, 1);
536 channel.read(buffer, 3, 0);
645 FileChannel channel = out.getChannel();
647 assertTrue("Assert 0: Channel is not open", channel.isOpen());
649 assertFalse("Assert 0: Channel is still open", channel
[all...]
/libcore/luni/src/main/java/java/nio/channels/spi/
H A DAbstractSelector.java63 * Implements the closing of this channel.
84 * Returns this channel's set of canceled selection keys.
91 * Registers {@code channel} with this selector.
94 * channel}.
96 * @return the key related to the channel and this selector.
98 protected abstract SelectionKey register(AbstractSelectableChannel channel, argument
102 * Deletes the key from the channel's key set.
105 ((AbstractSelectableChannel) key.channel()).deregister(key);
/libcore/harmony-tests/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/
H A DFileLockTest.java42 protected MockFileLock(FileChannel channel, long position, long size, argument
44 super(channel, position, size, shared);
77 assertNull(fileLock1.channel());
101 * @tests java.nio.channels.FileLock#channel()
104 assertSame(readWriteChannel, mockLock.channel());
106 assertNull(lock.channel());
H A DSelectionKeyTest.java71 public SelectableChannel channel() { method in class:SelectionKeyTest.MockSelectionKey
126 * @tests java.nio.channels.SelectionKey#channel()
129 assertSame(sc, selectionKey.channel());
132 assertSame(sc, selectionKey.channel());
H A DSelectorTest.java193 * @tests java.nio.channel.Selector#selectNow()
203 * @tests java.nio.channel.Selector#selectNow()
218 * @tests java.nio.channel.Selector#select()
228 * @tests java.nio.channel.Selector#select()
235 * @tests java.nio.channel.Selector#select(long)
250 * @tests java.nio.channel.Selector#select(long)
259 * @tests java.nio.channel.Selector#select(long)
449 SocketChannel channel = null;
451 channel = SocketChannel.open();
452 channel
[all...]
H A DServerSocketChannelTest.java134 // socket close makes the channel close
150 // socket close makes the channel close
248 // so must close the server channel with another thread.
255 fail("Fail to close the server channel because of"
401 SocketChannel channel; field in class:ServerSocketChannelTest.WriteChannelThread
405 public WriteChannelThread(SocketChannel channel, ByteBuffer buffer) { argument
406 this.channel = channel;
412 channel.write(buffer);
413 channel
[all...]
/libcore/harmony-tests/src/test/java/org/apache/harmony/nio/tests/java/nio/channels/spi/
H A DAbstractSelectionKeyTest.java56 public SelectableChannel channel() { method in class:AbstractSelectionKeyTest.MockSelectionKey
H A DAbstractSelectableChannelTest.java118 assertSame(sc, acceptKey.channel());
126 SocketChannel channel = SocketChannel.open();
127 channel.configureBlocking(false);
129 channel.register(selector, 0);
131 channel.close();
220 // if channel closed
/libcore/luni/src/main/java/java/util/logging/
H A DFileHandler.java191 FileChannel channel = fileStream.getChannel();
197 lock = channel.tryLock();
494 FileChannel channel = lock.channel();
496 channel.close();
/libcore/luni/src/test/java/libcore/java/net/
H A DOldSocketTest.java1098 SocketChannel channel = SocketChannel.open();
1099 channel.configureBlocking(false);
1100 Socket socket = channel.socket();
1391 SocketChannel channel = SocketChannel.open();
1392 channel.configureBlocking(false);
1393 Socket socket = channel.socket();
1399 channel.close();
1692 SocketChannel channel = SocketChannel.open();
1693 Socket socket = channel.socket();
1694 assertEquals(channel, socke
[all...]

Completed in 430 milliseconds

12