Examples of transferFrom()


Examples of java.nio.channels.FileChannel.transferFrom()

            long pos = 0;
            long count;
            while ( pos < size )
            {
                count = size - pos > FILE_COPY_BUFFER_SIZE ? FILE_COPY_BUFFER_SIZE : size - pos;
                pos += output.transferFrom( input, pos, count );
            }
        }
        finally
        {
            IOUtil.close( output );
View Full Code Here

Examples of java.nio.channels.WritableByteChannel.transferFrom()

            count = inChannel.transferTo(offset, inChannel.size() - offset, outChannel);
        } else if (output instanceof FileOutputStream) {
            FileChannel outChannel = ((FileOutputStream) output).getChannel();
            ReadableByteChannel inChannel = Channels.newChannel(input);
            do {
                n = outChannel.transferFrom(inChannel, offset + count, DEFAULT_BUFFER_SIZE);
                count += n;
            } while (n > 0);
        } else {
            byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
View Full Code Here

Examples of org.jnetpcap.nio.JBuffer.transferFrom()

    header.setWirelen(buffer.size());

    final int len = buffer.size();
    JBuffer b = getMemoryBuffer(len);

    b.transferFrom(buffer); // Make a buffer to buffer copy

    peer(b, 0, len);
   
    header.setWirelen(len);
  }
View Full Code Here

Examples of org.xnio.channels.StreamSinkChannel.transferFrom()

                throw WebSocketMessages.MESSAGES.lengthBiggerThenFileChannel();
            }
            StreamSinkChannel sink = StreamSinkChannelUtils.applyAsyncSendTimeout(session, createSink(length));
            long written = 0;
            while (written < length) {
                long w = sink.transferFrom(payloadChannel, offset + written, length - written);
                if (w == 0) {
                    final long writtenBytes = written;
                    sink.getWriteSetter().set(new ChannelListener<StreamSinkChannel>() {
                        long written = writtenBytes;
                        @Override
View Full Code Here

Examples of org.xnio.channels.StreamSinkChannel.transferFrom()

                        long written = writtenBytes;
                        @Override
                        public void handleEvent(StreamSinkChannel sink) {
                            try {
                                while (written < length) {
                                    long w = sink.transferFrom(payloadChannel, offset + written, length - written);
                                    if (w == 0) {
                                        sink.resumeWrites();
                                        return;
                                    }
                                    if (w > 0) {
View Full Code Here

Examples of org.xnio.channels.StreamSinkChannel.transferFrom()

                        throw UndertowMessages.MESSAGES.responseChannelAlreadyProvided();
                    }
                }

                while (size - pos > 0) {
                    long ret = dest.transferFrom(source, pos, size - pos);
                    pos += ret;
                    if (ret == 0) {
                        source.position(pos);
                        dest.getWriteSetter().set(this);
                        dest.resumeWrites();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.