Package org.apache.mina.core.buffer

Examples of org.apache.mina.core.buffer.IoBuffer.array()


                    + objectSize + " (expected: <= " + maxObjectSize + ')');
        }

        IoBuffer buf = IoBuffer.allocate(objectSize + 4, false);
        buf.putInt(objectSize);
        in.readFully(buf.array(), 4, objectSize);
        buf.position(0);
        buf.limit(objectSize + 4);

        return buf.getObject(classLoader);
    }
View Full Code Here


    output.put(handshakeBytes);
    output.put(randBytes);
    output.put(lastHash);
    output.flip();     
    if (log.isTraceEnabled()) {
      byte[] bOut = output.array();
      log.trace("First few bytes (out): {},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}", new Object[] {
          bOut[0], bOut[1], bOut[2], bOut[3], bOut[4],
          bOut[5], bOut[6], bOut[7], bOut[8], bOut[9],
          bOut[10], bOut[11], bOut[12], bOut[13], bOut[14],
          bOut[15]});
View Full Code Here

    }

    private String toString(ByteArray ba) {
        IoBuffer bb = IoBuffer.allocate(ba.length());
        ba.get(0, bb);
        byte[] bytes = bb.array();
        String string = new String(bytes);
        return string;
    }

    @Test
View Full Code Here

                continue;
            }

            int writtenBytes = buf.remaining();
            try {
                outputStream.write(buf.array(), buf.position(), writtenBytes);
                buf.position(buf.position() + writtenBytes);

                // increase written bytes
                increaseWrittenBytes(writtenBytes, System.currentTimeMillis());
View Full Code Here

                    + ')');
        }

        IoBuffer buf = IoBuffer.allocate(objectSize + 4, false);
        buf.putInt(objectSize);
        in.readFully(buf.array(), 4, objectSize);
        buf.position(0);
        buf.limit(objectSize + 4);

        return buf.getObject(classLoader);
    }
View Full Code Here

        if (objectSize > maxObjectSize) {
            throw new IllegalArgumentException("The encoded object is too big: " + objectSize + " (> " + maxObjectSize
                    + ')');
        }

        out.write(buf.array(), 0, buf.position());
    }

    public void writeBoolean(boolean v) throws IOException {
        out.writeBoolean(v);
    }
View Full Code Here

                continue;
            }

            int writtenBytes = buf.remaining();
            try {
                outputStream.write(buf.array(), buf.position(), writtenBytes);
                buf.position(buf.position() + writtenBytes);

                // increase written bytes
                increaseWrittenBytes(writtenBytes, System.currentTimeMillis());
View Full Code Here

                    + objectSize + " (expected: <= " + maxObjectSize + ')');
        }

        IoBuffer buf = IoBuffer.allocate(objectSize + 4, false);
        buf.putInt(objectSize);
        in.readFully(buf.array(), 4, objectSize);
        buf.position(0);
        buf.limit(objectSize + 4);

        return buf.getObject(classLoader);
    }
View Full Code Here

            throw new IllegalArgumentException(
                    "The encoded object is too big: " + objectSize + " (> "
                            + maxObjectSize + ')');
        }

        out.write(buf.array(), 0, buf.position());
    }

    public void writeBoolean(boolean v) throws IOException {
        out.writeBoolean(v);
    }
View Full Code Here

    }

    private String toString(ByteArray ba) {
        IoBuffer bb = IoBuffer.allocate(ba.length());
        ba.get(0, bb);
        byte[] bytes = bb.array();
        String string = new String(bytes);
        return string;
    }

    public void testCompositeStringJoin() throws Exception {
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.