"Cannot wrap a prefetcher with a prefetcher."); if (!chan.isOpen()) { throw new IllegalArgumentException("channel must be open");
@Test(timeout = 60_000) public void testReadByteChannel() throws IOException { CloudStorageFileSystem testBucket = getTestBucket(); Path path = testBucket.getPath(SML_FILE); long size = Files.size(path); SeekableByteChannel chan = Files.newByteChannel(path, StandardOpenOption.READ); assertThat(chan.size()).isEqualTo(size); ByteBuffer buf = ByteBuffer.allocate(SML_SIZE); int read = 0; while (chan.isOpen()) { int rc = chan.read(buf); assertThat(chan.size()).isEqualTo(size); if (rc < 0) { // EOF break; } assertThat(rc).isGreaterThan(0); read += rc; assertThat(chan.position()).isEqualTo(read); } assertThat(read).isEqualTo(size); byte[] expected = new byte[SML_SIZE]; new Random(SML_SIZE).nextBytes(expected); assertThat(Arrays.equals(buf.array(), expected)).isTrue(); }
@Override public boolean isOpen() { return channel.isOpen(); }
@Override public boolean isOpen() { return seekable.isOpen(); }
@Override public boolean isOpen() { return delegate.isOpen(); }
@Override @GuardedBy("this") public synchronized boolean isOpen() { return ciphertextChannel.isOpen(); } }
@Override @GuardedBy("lock") public boolean isOpen() { lock.lock(); try { return channel.isOpen(); } finally { lock.unlock(); } }
@Override public int available() throws IOException { if (!channel.isOpen()) { throw new ClosedChannelException(); } return super.available(); } }
@Override public boolean isOpen() { return input.isOpen(); }
@Test public void testClosedChannelIsClosed() throws IOException { try( SeekableByteChannel read = Files.newByteChannel( getFile() ) ) { read.close(); assertThat( read.isOpen() ).isEqualTo( false ); } }
@Override public void close() throws IOException { try { if (!seekable.isOpen()) return; seekable.close(); if (options.contains(StandardOpenOption.DELETE_ON_CLOSE)) { path.getFileSystem().provider().delete(path); return; } if (options.contains(StandardOpenOption.READ) && options.size() == 1) { return; } sync(); } finally { Files.deleteIfExists(tempFile); } }
@Override public void close() throws IOException { super.close(); SeekableByteChannel channel = getFileChannel(); if (channel.isOpen()) { channel.close(); } }
@Override public boolean isOpen() { checkUndeclaredExceptions(); return delegate.isOpen(); }
data == null ? -1 : data.length, maxChunkSize, chunkStart, writeOffset); if (!channel.isOpen()) { logger.debug("loadNextRegion(): channel closed"); throw new ParserEOFException("Channel is closed, likely completely consumed");
ciphertextChannelSize = ciphertextChannel.size(); aad = Arrays.copyOf(associatedData, associatedData.length); isopen = ciphertextChannel.isOpen(); int fullSegments = (int) (ciphertextChannelSize / ciphertextSegmentSize); int remainder = (int) (ciphertextChannelSize % ciphertextSegmentSize);
log.debug("Channel open: {} size: {} position: {}", channel.isOpen(), size, channel.position()); if (size > 0L) {
if (msg instanceof HttpContent) { synchronized (taskInfo) { if (!isSuccess || !fileChannel.isOpen() || !ctx.channel().isOpen()) { return;