Package org.jboss.marshalling

Examples of org.jboss.marshalling.ByteOutput


   public void tearDown() {
   }
  
   public void testSerObjWithRefToSerObjectWithCustomReadObj() throws Exception {
      ByteArrayOutputStream baos = new ByteArrayOutputStream(10240);
      ByteOutput byteOutput = Marshalling.createByteOutput(baos);
      marshaller.start(byteOutput);
      ObjectThatContainsACustomReadObjectMethod obj = new ObjectThatContainsACustomReadObjectMethod();
      obj.anObjectWithCustomReadObjectMethod = new CustomReadObjectMethod();
      try {
         marshaller.writeObject(obj);
View Full Code Here


    @Test
    public void testEqualBuffer() throws Exception {
        final byte[] content = "1234567890".getBytes();

        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

        byteOutput.write(content);
        byteOutput.flush();

        final byte[] chunked = byteArrayOutputStream.toByteArray();

        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
        final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
View Full Code Here

    @Test
    public void testMultiChunk() throws Exception {
        final byte[] content = "12345678901234567890123456789012345678901234567890".getBytes();

        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

        byteOutput.write(content);
        byteOutput.flush();

        final byte[] chunked = byteArrayOutputStream.toByteArray();

        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
        final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
View Full Code Here

    @Test
    public void testRemainingBytes() throws Exception {
        final byte[] content = "1234567890123456789012345678901234567890123".getBytes();

        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

        byteOutput.write(content);
        byteOutput.flush();

        final byte[] chunked = byteArrayOutputStream.toByteArray();

        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
        final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
View Full Code Here

    @Test
    public void testIncompleteRead() throws Exception {
        final byte[] content = "1234567890123456789012345678901234567890123".getBytes();

        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

        byteOutput.write(content);
        byteOutput.flush();

        final byte[] chunked = byteArrayOutputStream.toByteArray();

        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
        final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
View Full Code Here

    @Test
    public void testOffsetRead() throws Exception {
        final byte[] content = "1234567890123456789012345678901234567890123".getBytes();

        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        final ByteOutput byteOutput = new ChunkyByteOutput(Marshalling.createByteOutput(byteArrayOutputStream), 10);

        byteOutput.write(content);
        byteOutput.flush();

        final byte[] chunked = byteArrayOutputStream.toByteArray();

        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(chunked);
        final ByteInput byteInput = new ChunkyByteInput(Marshalling.createByteInput(byteArrayInputStream));
View Full Code Here

     * It will then flush the underlying byte output.
     *
     * @throws IOException
     */
    public void flush() throws IOException {
        final ByteOutput output = this.output;
        final int pos = this.position;
        if (pos > 0) {
            output.write(CHUNK_START);
            writeInt(pos);
            final byte[] buffer = this.buffer;
            output.write(buffer, 0, pos);
        }
        this.position = 0;
    }
View Full Code Here

        }
        this.position = 0;
    }

    public void writeInt(final int i) throws IOException {
        final ByteOutput output = this.output;
        byte[] bytes = new byte[4];
        bytes[0] = (byte) (i >> 24);
        bytes[1] = (byte) (i >> 16);
        bytes[2] = (byte) (i >> 8);
        bytes[3] = (byte) i;
        output.write(bytes);
    }
View Full Code Here

            @Override
            public void write(final byte[] b, final int off, final int len) throws IOException {
                dataOutput.write(b, off, len);
            }
        };
        final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream);
        // start the marshaller
        marshaller.start(byteOutput);

        return marshaller;
    }
View Full Code Here

                public void write(int b) throws IOException {
                    final int byteToWrite = b & 0xff;
                    output.write(byteToWrite);
                }
            };
            final ByteOutput byteOutput = Marshalling.createByteOutput(outputStream);
            this.delegate.start(byteOutput);
        }
View Full Code Here

TOP

Related Classes of org.jboss.marshalling.ByteOutput

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.