Package java.nio

Examples of java.nio.ByteBuffer.arrayOffset()


    }

    @Override
    public KeyValue getKeyValue() {
      ByteBuffer kvBuf = getKeyValueBuffer();
      KeyValue kv = new KeyValue(kvBuf.array(), kvBuf.arrayOffset(), kvBuf.array().length
          - kvBuf.arrayOffset());
      kv.setMvccVersion(current.memstoreTS);
      return kv;
    }
View Full Code Here


    @Override
    public KeyValue getKeyValue() {
      ByteBuffer kvBuf = getKeyValueBuffer();
      KeyValue kv = new KeyValue(kvBuf.array(), kvBuf.arrayOffset(), kvBuf.array().length
          - kvBuf.arrayOffset());
      kv.setMvccVersion(current.memstoreTS);
      return kv;
    }

    @Override
View Full Code Here

        throw new RuntimeException(MessageFormat.format(
            JGitText.get().unencodeableFile, getName()));
      }

      encodedNameLen = b.limit();
      if (b.hasArray() && b.arrayOffset() == 0)
        encodedName = b.array();
      else
        b.get(encodedName = new byte[encodedNameLen]);
    }
View Full Code Here

   * @see #CHARACTER_ENCODING
   */
  public static byte[] encode(final String str) {
    final ByteBuffer bb = Constants.CHARSET.encode(str);
    final int len = bb.limit();
    if (bb.hasArray() && bb.arrayOffset() == 0) {
      final byte[] arr = bb.array();
      if (arr.length == len)
        return arr;
    }

View Full Code Here

    protected static byte[] toArray(ByteBuffer... payload) {
        if (payload.length == 1) {
            ByteBuffer buf = payload[0];
            if (buf.hasArray()
                    && buf.arrayOffset() == 0
                    && buf.position() == 0
                    && buf.array().length == buf.remaining()) {
                return buf.array();
            }
        }
View Full Code Here

        int offset;
        int length;
        try {
            ByteBuffer decode = FlexBase64.decode(nonce);
            complete = decode.array();
            offset = decode.arrayOffset();
            length = decode.limit() - offset;
        } catch (IOException e) {
            throw MESSAGES.invalidBase64Token(e);
        }
View Full Code Here

                if (current.startsWith(BASIC_PREFIX)) {
                    String base64Challenge = current.substring(PREFIX_LENGTH);
                    String plainChallenge = null;
                    try {
                        ByteBuffer decode = FlexBase64.decode(base64Challenge);
                        plainChallenge = new String(decode.array(), decode.arrayOffset(), decode.limit(), UTF_8);
                    } catch (IOException e) {
                    }
                    int colonPos;
                    if (plainChallenge != null && (colonPos = plainChallenge.indexOf(COLON)) > -1) {
                        String userName = plainChallenge.substring(0, colonPos);
View Full Code Here

                    int ret = source.read(buffer);
                    if (ret <= 0) {
                        break;
                    }
                    pos += ret;
                    outputStream.write(buffer.array(), buffer.arrayOffset(), ret);
                    buffer.clear();
                }

                if (pos != size) {
                    throw new EOFException("Unexpected EOF reading file");
View Full Code Here

                int copyLength =
                    (availableContentLen > readBuffer.capacity()) ?
                    readBuffer.capacity() : availableContentLen;

                readBuffer.clear();
                readBuffer.put(data, startAtTarget.arrayOffset(), copyLength);
                readBuffer.flip();

                /* LogBuffers were just written and use the current version. */
                setFileNum(windowFileNum, LogEntryType.LOG_VERSION);
                startOffset = targetOffset;
View Full Code Here

            SVNDiffInstruction.writeInt(offsets, myNewDataLength);
        }
        os.write(offsets.array(), offsets.arrayOffset(), offsets.position());
        if (compress) {
            os.write(instructions.array(), instructions.arrayOffset(), instructions.remaining());
            os.write(newData.array(), newData.arrayOffset(), newData.remaining());
        } else {
            os.write(myData, myDataOffset, myInstructionsLength);
            if (myNewDataLength > 0) {
                os.write(myData, myDataOffset + myInstructionsLength, myNewDataLength);
            }
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.