Examples of asCharBuffer()


Examples of java.nio.ByteBuffer.asCharBuffer()

     */
    public void testBufferView() {
        ByteBuffer b = ByteBuffer.allocateDirect(100);
        assertTrue(b.isDirect());
        assertView("duplicate", b, b.duplicate(), 1);
        assertView("char view", b, b.asCharBuffer(), 2);
        assertView("short view", b, b.asShortBuffer(), 2);
        assertView("int view", b, b.asIntBuffer(), 4);
        assertView("float view", b, b.asFloatBuffer(), 4);
        assertView("double view", b, b.asDoubleBuffer(), 8);
        assertView("long view", b, b.asLongBuffer(), 8);
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

        System.arraycopy(bytes, 0, buffer.array(), 0, 4);
        byte[] portBytes = new byte[2];
        System.arraycopy(bytes, 4, portBytes, 0, portBytes.length);
        try
        {
            CharBuffer charBuffer = buffer.asCharBuffer();
            String host = hostNames_.get(charBuffer);
            if (host == null)
            {              
                host = InetAddress.getByAddress(buffer.array()).getHostName();             
                hostNames_.put(charBuffer, host);
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

        inputStream.reset();
        ByteArrayInputStream bais = new ByteArrayInputStream(buf,0, len);

        //check for unicode marker
        ByteBuffer bb = java.nio.ByteBuffer.wrap(buf);
        CharBuffer cb = bb.asCharBuffer();
        char marker = cb.get(0);
       
        if (marker == 0xfffe || marker == 0xfeff) {
            Reader reader = IOUtil.bufferedReader(bais, "UTF-16");
            LineNumberReader line = new LineNumberReader(reader);
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

        System.arraycopy(bytes, 0, buffer.array(), 0, 4);
        byte[] portBytes = new byte[2];
        System.arraycopy(bytes, 4, portBytes, 0, portBytes.length);
        try
        {
            CharBuffer charBuffer = buffer.asCharBuffer();
            String host = hostNames_.get(charBuffer);
            if (host == null)
            {              
                host = InetAddress.getByAddress(buffer.array()).getHostAddress();             
                hostNames_.put(charBuffer, host);
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

    public DatagramDownPacket getDatagramPacket() {
        DatagramDownPacket packet = new DatagramDownPacket();
        ArrayList list = new ArrayList();

        ByteBuffer buffer = ByteBuffer.allocate(1024);
        CharBuffer b = buffer.asCharBuffer();
        b.put("Hello! " + id++);

        buffer.position(b.position() * 2);
        buffer.flip();
        list.add(buffer);
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

                        + fileChannel.position());
               }
               buffer.rewind();
               long start = System.nanoTime();
               if (stringData) {
                  String cacheData = buffer.asCharBuffer().toString();
                  start = System.nanoTime();
                  cache.put(key, cacheData);
               } else {
                  cache.put(key, buffer.array());
               }
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

        ByteBuffer buffer = getTableBuffer(gaspTag);
        if (buffer == null) {
            return gaspTable = new char[0];
        }

        CharBuffer cbuffer = buffer.asCharBuffer();
        char format = cbuffer.get();
        /* format "1" has appeared for some Windows Vista fonts.
         * Its presently undocumented but the existing values
         * seem to be still valid so we can use it.
         */
 
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

    public DatagramDownPacket getDatagramPacket() {
        DatagramDownPacket packet = new DatagramDownPacket();
        ArrayList list = new ArrayList();

        ByteBuffer buffer = ByteBuffer.allocate(1024);
        CharBuffer b = buffer.asCharBuffer();
        b.put("Hello! " + id++);

        buffer.position(b.position() * 2);
        buffer.flip();
        list.add(buffer);
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

        ByteBuffer buffer = getTableBuffer(gaspTag);
        if (buffer == null) {
            return gaspTable = new char[0];
        }

        CharBuffer cbuffer = buffer.asCharBuffer();
        char format = cbuffer.get();
        /* format "1" has appeared for some Windows Vista fonts.
         * Its presently undocumented but the existing values
         * seem to be still valid so we can use it.
         */
 
View Full Code Here

Examples of java.nio.ByteBuffer.asCharBuffer()

        System.arraycopy(bytes, 0, buffer.array(), 0, 4);
        byte[] portBytes = new byte[2];
        System.arraycopy(bytes, 4, portBytes, 0, portBytes.length);
        try
        {
            CharBuffer charBuffer = buffer.asCharBuffer();
            String host = hostNames_.get(charBuffer);
            if (host == null)
            {              
                host = InetAddress.getByAddress(buffer.array()).getHostAddress();             
                hostNames_.put(charBuffer, host);
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.