Refine search
private int getBytes(int index, GatheringByteChannel out, int length, boolean internal) throws IOException { ensureAccessible(); ByteBuffer tmpBuf; if (internal) { tmpBuf = internalNioBuffer(); } else { tmpBuf = ByteBuffer.wrap(array); } return out.write((ByteBuffer) tmpBuf.clear().position(index).limit(index + length)); }
@Override public boolean isOpen() { return channel.isOpen(); }
@Override public void close() throws IOException { channel.close(); completedFiles.add(tmpFile); filesInProcess.remove(tmpFile); if (!writerCurrentlyInUse) { mergeWithSmoosher(); } }
public int getBytes(int index, GatheringByteChannel out, int length) throws IOException { return out.write(ByteBuffer.wrap(array, index, length)); }
public int getBytes(int index, GatheringByteChannel out, int length) throws IOException { return out.write(ByteBuffer.wrap(array, index, length)); }
@Override public long transferTo(WritableByteChannel target, long position) throws IOException { GatheringByteChannel channel = (GatheringByteChannel) target; long write = channel.write(this.buffers); transferred += write; return write; }
@Override public boolean isOpen() { return channel.isOpen(); }
@Override public void close() throws IOException { channel.close(); completedFiles.add(tmpFile); filesInProcess.remove(tmpFile); if (!writerCurrentlyInUse) { mergeWithSmoosher(); } }
private int getBytes(int index, GatheringByteChannel out, int length, boolean internal) throws IOException { ensureAccessible(); if (length == 0) { return 0; } ByteBuffer tmpBuf; if (internal) { tmpBuf = internalNioBuffer(); } else { tmpBuf = buffer.duplicate(); } tmpBuf.clear().position(index).limit(index + length); return out.write(tmpBuf); }
@Override public long writeTo(GatheringByteChannel channel, long position, int length) throws IOException { if (position > Integer.MAX_VALUE) throw new IllegalArgumentException("position should not be greater than Integer.MAX_VALUE: " + position); if (position + length > buffer.limit()) throw new IllegalArgumentException("position+length should not be greater than buffer.limit(), position: " + position + ", length: " + length + ", buffer.limit(): " + buffer.limit()); int pos = (int) position; ByteBuffer dup = buffer.duplicate(); dup.position(pos); dup.limit(pos + length); return channel.write(dup); }
@Override public Void call() throws Exception { _countDownLatch.await(); try { BlockingQueue<Datagram> sendingQueue = (BlockingQueue<Datagram>)_channelContext.getSendingQueue(); while (true) { Datagram datagram = sendingQueue.take(); _channelContext.setWritingDatagram(datagram); if (!handleWriting( _gatheringByteChannel, _channelContext)) { if (_gatheringByteChannel.isOpen()) { // Still open but no longer writable, typical // behavior of nonblocking channel throw new IllegalStateException( _gatheringByteChannel + " behaved in nonblocking way."); } break; } cleanUpTimeoutResponseWaitingDatagrams(); } } catch (InterruptedException ie) { } return null; }
@Override public void close() throws IOException { channel.close(); completedFiles.add(tmpFile); filesInProcess.remove(tmpFile); if (!writerCurrentlyInUse) { mergeWithSmoosher(); } }
private int getBytes(int index, GatheringByteChannel out, int length, boolean internal) throws IOException { ensureAccessible(); if (length == 0) { return 0; } ByteBuffer tmpBuf; if (internal) { tmpBuf = internalNioBuffer(); } else { tmpBuf = buffer.duplicate(); } tmpBuf.clear().position(index).limit(index + length); return out.write(tmpBuf); }
@Override public long writeTo(GatheringByteChannel channel) throws IOException { long written = channel.write(buffers); if (written < 0) throw new EOFException("Wrote negative bytes to channel. This shouldn't happen."); remaining -= written; pending = TransportLayers.hasPendingWrites(channel); return written; } }
@Override public boolean isOpen() { return channel.isOpen(); }
private int getBytes(int index, GatheringByteChannel out, int length, boolean internal) throws IOException { checkIndex(index, length); index = idx(index); ByteBuffer tmpBuf; if (internal) { tmpBuf = internalNioBuffer(); } else { tmpBuf = ByteBuffer.wrap(memory); } return out.write((ByteBuffer) tmpBuf.clear().position(index).limit(index + length)); }
public int getBytes(int index, GatheringByteChannel out, int length) throws IOException { return out.write(ByteBuffer.wrap(array, index, length)); }
@Override public boolean isOpen() { return channel.isOpen(); }