Package java.nio

Examples of java.nio.ByteOrder


            return this;
        }

        // Shrink and compact:
        //// Save the state.
        ByteOrder bo = order();

        //// Reallocate.
        ByteBuffer oldBuf = buf();
        ByteBuffer newBuf = getAllocator()
                .allocateNioBuffer(newCapacity, isDirect());
View Full Code Here


                return this;
            }

            // Shrink and compact:
            //// Save the state.
            ByteOrder bo = order();

            //// Sanity check.
            if (remaining > newCapacity) {
                throw new IllegalStateException(
                        "The amount of the remaining bytes is greater than "
View Full Code Here

    public CompositeChannelBuffer(ChannelBuffer... buffers) {
        if (buffers.length == 0) {
            throw new IllegalArgumentException("buffers should not be empty.");
        }

        ByteOrder expectedEndianness = null;
        for (ChannelBuffer buffer : buffers) {
            if (buffer.capacity() != 0) {
                expectedEndianness = buffer.order();
            }
        }
View Full Code Here

    public CompositeChannelBuffer(ChannelBuffer... buffers) {
        if (buffers.length == 0) {
            throw new IllegalArgumentException("buffers should not be empty.");
        }

        ByteOrder expectedEndianness = null;
        for (ChannelBuffer buffer : buffers) {
            if (buffer.capacity() != 0) {
                expectedEndianness = buffer.order();
            }
        }
View Full Code Here

        if (newCapacity > capacity()) {
            // Expand:
            // // Save the state.
            int pos = position();
            int limit = limit();
            ByteOrder bo = order();

            // // Reallocate.
            ByteBuffer oldBuf = buf();
            ByteBuffer newBuf = getAllocator().allocateNioBuffer(newCapacity, isDirect());
            oldBuf.clear();
View Full Code Here

            return this;
        }

        // Shrink and compact:
        // // Save the state.
        ByteOrder bo = order();

        // // Reallocate.
        ByteBuffer oldBuf = buf();
        ByteBuffer newBuf = getAllocator().allocateNioBuffer(newCapacity, isDirect());
        oldBuf.position(0);
View Full Code Here

                return this;
            }

            // Shrink and compact:
            // // Save the state.
            ByteOrder bo = order();

            // // Sanity check.
            if (remaining > newCapacity) {
                throw new IllegalStateException("The amount of the remaining bytes is greater than "
                        + "the new capacity.");
View Full Code Here

            if (buffers[0].readable()) {
                return wrappedBuffer(buffers[0]);
            }
            break;
        default:
            ByteOrder order = null;
            final List<ChannelBuffer> components = new ArrayList<ChannelBuffer>(buffers.length);
            for (ChannelBuffer c: buffers) {
                if (c == null) {
                    break;
                }
                if (c.readable()) {
                    if (order != null) {
                        if (!order.equals(c.order())) {
                            throw new IllegalArgumentException(
                                    "inconsistent byte order");
                        }
                    } else {
                        order = c.order();
View Full Code Here

            if (buffers[0].hasRemaining()) {
                return wrappedBuffer(buffers[0]);
            }
            break;
        default:
            ByteOrder order = null;
            final List<ChannelBuffer> components = new ArrayList<ChannelBuffer>(buffers.length);
            for (ByteBuffer b: buffers) {
                if (b == null) {
                    break;
                }
                if (b.hasRemaining()) {
                    if (order != null) {
                        if (!order.equals(b.order())) {
                            throw new IllegalArgumentException(
                                    "inconsistent byte order");
                        }
                    } else {
                        order = b.order();
View Full Code Here

     * @return 0 if strings are equal,
     * &lt;0 if Java string is lexicographically less than the native string,
     * &gt;0 if Java string is lexicographically greater than the native string.
     */
    public int compareString(String strObj, long str, int len, int byteOrder) {
        ByteOrder or = ByteOrder.nativeOrder();
        String cmpTo = createString(str, 2 * len);
        if ((byteOrder == 1 && or == ByteOrder.BIG_ENDIAN)
                || (byteOrder == 2 && or == ByteOrder.LITTLE_ENDIAN)) {
            return strObj.compareTo(cmpTo);
        }
View Full Code Here

TOP

Related Classes of java.nio.ByteOrder

Copyright © 2018 www.massapicom. 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.