Examples of CharArrayWrapper


Examples of com.cloudhopper.commons.charset.CharSequenceAccessor.CharArrayWrapper

    @Override
    public byte[] encode(CharSequence charSeq) {
        if (charSeq == null) {
            return null;
        }
        CharArrayWrapper wrapper = CharSequenceAccessor.access(charSeq);
        if (wrapper != null) {
            // use more efficient direct access to char array using the wrapper
            int utf8len = calculateByteLength(null, wrapper.value, wrapper.offset, wrapper.length);
            byte[] buf = new byte[utf8len];
            encodeToByteArray(null, wrapper.value, wrapper.offset, wrapper.length, buf, 0);
View Full Code Here

Examples of com.cloudhopper.commons.charset.CharSequenceAccessor.CharArrayWrapper

        if (bytes == null) {
            return;
        }
        // expand buffer as necessary to support all possible UTF-8 bytes
        buffer.ensureCapacity(buffer.length()+bytes.length);
        CharArrayWrapper wrapper = CharSequenceAccessor.access(buffer);
        // since we want to mimic an "append", the "length" of the existing char
        // array represents how much data is currently contained inside it
        // we'll start our "append" at that offset
        int charLength = decodeToCharArray(bytes, 0, bytes.length, wrapper.value, wrapper.length);
        // the "wrapper" is merely prepped for reading
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

        } else if (componentType.equals(Integer.class)) {
            return (ArrayWrapper<T>) new IntegerArrayWrapper((Integer[]) array);
        } else if (componentType.equals(Long.class)) {
            return (ArrayWrapper<T>) new LongArrayWrapper((Long[]) array);
        } else if (componentType.equals(Character.class)) {
            return (ArrayWrapper<T>) new CharArrayWrapper((Character[]) array);
        } else if (componentType.equals(Boolean.class)) {
            return (ArrayWrapper<T>) new BooleanArrayWrapper((Boolean[]) array);
        } else if (componentType.equals(Float.class)) {
            return (ArrayWrapper<T>) new FloatArrayWrapper((Float[]) array);
        } else if (componentType.equals(Double.class)) {
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

        }
    }

    @Override
    public Wrapper<Character> sort() {
        return new CharArrayWrapper(charSequenceToArray(charSequence)).sort();
    }
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

        return new CharArrayWrapper(charSequenceToArray(charSequence)).sort();
    }

    @Override
    public Character[] toArray() {
        return new CharArrayWrapper(charSequenceToArray(charSequence)).toArray();
    }
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

    // array boxing tests
    @Test
    public void boxCharacterArray() {
        char[] unboxed = new char[]{'f', 'o', 'o'};
        CharArrayWrapper arrayWrapper = new CharArrayWrapper(unboxed);
        Assert.assertArrayEquals(new Character[]{'f', 'o', 'o'}, arrayWrapper.toArray());
    }
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

    // unboxing
    @Test
    public void unboxCharacterArray() {
        Character[] boxed = new Character[]{'f', 'o', 'o'};
        CharArrayWrapper arrayWrapper = new CharArrayWrapper(boxed);
        Assert.assertArrayEquals(new char[]{'f', 'o', 'o'}, arrayWrapper.toCharArray());
    }
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

    }

    @Test
    public void unboxCharacterArrayToByteArray() {
        Character[] boxed = new Character[] { 'f', 'o', 'o' };
        CharArrayWrapper arrayWrapper = new CharArrayWrapper(boxed);
        Assert.assertArrayEquals(new byte[] { 'f', 'o', 'o' },
                arrayWrapper.toByteArray());
    }
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

    }

    @Test
    public void unboxCharacterArrayToIntArray() {
        Character[] boxed = new Character[]{'f', 'o', 'o'};
        CharArrayWrapper arrayWrapper = new CharArrayWrapper(boxed);
        Assert.assertArrayEquals(new int[]{'f', 'o', 'o'}, arrayWrapper.toIntArray());
    }
View Full Code Here

Examples of com.humaorie.dollar.ArrayWrapper.CharArrayWrapper

    }

    @Test
    public void unboxCharacterArrayToLongArray() {
        Character[] boxed = new Character[]{'f', 'o', 'o'};
        CharArrayWrapper arrayWrapper = new CharArrayWrapper(boxed);
        Assert.assertArrayEquals(new long[]{'f', 'o', 'o'}, arrayWrapper.toLongArray());
    }
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.