Package java.nio

Examples of java.nio.ByteBuffer.compact()


     
      while (inputChannel.read(buffer) > 0)
      {
        buffer.flip();
        fileChannel.write(buffer);
        buffer.compact();
      }
     
      return file;
    }
    finally
View Full Code Here


        try {
            final ByteBuffer buffer = ByteBuffer.allocate(8 * 1024);
            while (src.read(buffer) != -1) {
                buffer.flip();
                dest.write(buffer);
                buffer.compact();
            }
            buffer.flip();

            while (buffer.hasRemaining()) {
                dest.write(buffer);
View Full Code Here

       
        while (inputChannel.read(buffer) > 0)
        {
          buffer.flip();
          fileChannel.write(buffer);
          buffer.compact();
        }
       
        return file;
      }
      finally
View Full Code Here

        try {
            final ByteBuffer buffer = ByteBuffer.allocate(8 * 1024);
            while (src.read(buffer) != -1) {
                buffer.flip();
                dest.write(buffer);
                buffer.compact();
            }
            buffer.flip();

            while (buffer.hasRemaining()) {
                dest.write(buffer);
View Full Code Here

                    //in which case we notify the conduit and reset the state
                    if (state.isComplete()) {
                        if (state.prefix == 6) {
                            currentRequest.getAjpClientRequestConduit().setBodyChunkRequested(state.currentIntegerPart);
                            state.reset();
                            buffer.compact();
                        } else if (buffer.hasRemaining()) {
                            free = false;
                            pushBackStreamSourceConduit.pushBack(pooled);
                        }
                    } else {
View Full Code Here

                    //in which case we notify the conduit and reset the state
                    if (state.isComplete()) {
                        if (state.prefix == 6) {
                            currentRequest.getAjpClientRequestConduit().setBodyChunkRequested(state.currentIntegerPart);
                            state.reset();
                            buffer.compact();
                        } else {
                            //todo: ping?
                            UndertowLogger.CLIENT_LOGGER.debugf("Received invalid AJP response code %s with no request active, closing connection", state.prefix);
                            //invalid, at this point read body chunk is all the server should be sending
                            safeClose(connection);
View Full Code Here

            ByteBuffer buf = eb.getResource();
            final ByteBuffer ugBuffer = unget.getResource();

            if (ugBuffer.limit() - ugBuffer.remaining() > buf.remaining()) {
                //stuff the existing data after the data we are ungetting
                ugBuffer.compact();
                ugBuffer.put(buf);
                ugBuffer.flip();
                eb.free();
                setExtraBytes(unget);
            } else {
View Full Code Here

    buf.limit(6);
    buf.position(1);
    buf.mark();
    buf.get();
   
    h.check(buf.compact(), buf, "compact() return value");
    h.check(buf.position(), 4, "compact()/position");
    h.check(buf.limit(), size, "compact()/limit");
    try
      {
        buf.reset();
View Full Code Here

                            inputBuffer.clear();
                        }
                        outputBuffer.clear();
                    }
                } else if (coderResult.isUnderflow()) {
                    inputBuffer.compact();
                    return;
                }
            }
        }
    }
View Full Code Here

                if (!plain.hasRemaining()) {

                    if (status == SSLEngineResult.Status.OK && handshakeStatus != SSLEngineResult.HandshakeStatus.NEED_UNWRAP) {
                        plain.clear();
                    } else {
                        plain.compact();
                    }
                    int readCount = secureRead(plain);


                    if (readCount == 0)
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.