Package java.nio.channels

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


        } else if (output instanceof FileOutputStream) {
            FileChannel outChannel = ((FileOutputStream) output).getChannel();
            ReadableByteChannel inChannel = Channels.newChannel(input);
            do {
                if (count < DEFAULT_BUFFER_SIZE) {
                    n = outChannel.transferFrom(inChannel, offset + rcount, count);
                } else {
                    n = outChannel.transferFrom(inChannel, offset + rcount, DEFAULT_BUFFER_SIZE);
                }
                count -= n;
                rcount += n;
View Full Code Here

            ReadableByteChannel inChannel = Channels.newChannel(input);
            do {
                if (count < DEFAULT_BUFFER_SIZE) {
                    n = outChannel.transferFrom(inChannel, offset + rcount, count);
                } else {
                    n = outChannel.transferFrom(inChannel, offset + rcount, DEFAULT_BUFFER_SIZE);
                }
                count -= n;
                rcount += n;
            } while (n > 0);
        } else {
View Full Code Here

            count = inChannel.transferTo(0, inChannel.size(), outChannel);
        } else if (output instanceof FileOutputStream) {
            FileChannel outChannel = ((FileOutputStream) output).getChannel();
            ReadableByteChannel inChannel = Channels.newChannel(input);
            do {
                n = outChannel.transferFrom(inChannel, count, DEFAULT_BUFFER_SIZE);
                count += n;
            } while (n > 0);
        } else {
            byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
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.