Examples of encode()


Examples of org.apache.mina.coap.codec.CoapEncoder.encode()

                for (int i = 0; i < count; i++) {
                    buff.position(0);
                    buff.limit(buff.capacity());
                    int id = r.nextInt(1024);
                    msg.setId(id);
                    int bytes = channel.send(encoder.encode(msg, null), target);

                    if (bytes < 1) {
                        System.err.println("write fail :/ " + bytes);
                    } else {
                        buff.position(0);

Examples of org.apache.mina.filter.codec.ProtocolEncoder.encode()

                return null;
            }
        };

        ProtocolEncoder encoder = new ObjectSerializationEncoder();
        encoder.encode(session, expected, out);

        Assert.assertEquals(1, out.getBufferQueue().size());
        ByteBuffer buf = out.getBufferQueue().poll();

        testDecoderAndInputStream(expected, buf);

Examples of org.apache.mina.protocol.ProtocolEncoder.encode()

                        Object message = writeQueue.pop();
                        if( message == null )
                            break;

                        Queue queue = psession.encOut.getBufferQueue();
                        encoder.encode( psession, message, psession.encOut );
                        for( ;; )
                        {
                            ByteBuffer buf = ( ByteBuffer ) queue.pop();
                            if( buf == null )
                                break;

Examples of org.apache.pdfbox.filter.Filter.encode()

            PDColorSpace initColorSpace) throws IOException
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        Filter filter = FilterFactory.INSTANCE.getFilter(COSName.FLATE_DECODE);
        filter.encode(new ByteArrayInputStream(byteArray), baos, new COSDictionary(), 0);

        ByteArrayInputStream filteredByteStream = new ByteArrayInputStream(baos.toByteArray());
        return new PDImageXObject(document, filteredByteStream, COSName.FLATE_DECODE,
                width, height, bitsPerComponent, initColorSpace);
    }

Examples of org.apache.pdfbox.pdmodel.font.PDFont.encode()

        int codeLength = 1;
        for( int i=0; i<string.length; i+=codeLength )
        {
            // Decode the value to a Unicode character
            codeLength = 1;
            String c = font.encode( string, i, codeLength );
            if( c == null && i+1<string.length)
            {
                //maybe a multibyte encoding
                codeLength++;
                c = font.encode( string, i, codeLength );

Examples of org.apache.qpid.amqp_1_0.type.messaging.AmqpValue.encode()

        AmqpValue section = new AmqpValue(new Declare());


        Transfer transfer = new Transfer();
        transfer.setPayload(section.encode(encoder).asByteBuffer());
        transfer.setDeliveryTag(DELIVERY_TAG);
        transfer.setSettled(Boolean.FALSE);
        final Object lock = _endpoint.getLock();
        synchronized(lock)
        {

Examples of org.apache.qpid.codec.AMQEncoder.encode()

        // so the protocol handler is not set up to know whether it should be expecting a PI frame or
        // a different type of frame
        AMQDecoder decoder = new AMQDecoder(true);
        AMQEncoder encoder = new AMQEncoder();
        TestProtocolEncoderOutput peo = new TestProtocolEncoderOutput();
        encoder.encode(_mockIoSession, pi, peo);
        TestProtocolDecoderOutput pdo = new TestProtocolDecoderOutput();
        decoder.decode(_mockIoSession, peo.result, pdo);
        ((ProtocolInitiation) pdo.result).checkVersion(this);
    }

Examples of org.apache.qpid.proton.message.ProtonJMessage.encode()

                amqp.getHeader().setDeliveryCount(new UnsignedInteger(count));

                // Re-encode...
                ByteBuffer buffer = ByteBuffer.wrap(new byte[1024*4]);
                final DroppingWritableBuffer overflow = new DroppingWritableBuffer();
                int c = amqp.encode(new CompositeWritableBuffer(new WritableBuffer.ByteBufferWrapper(buffer), overflow));
                if( overflow.position() > 0 ) {
                    buffer = ByteBuffer.wrap(new byte[1024*4+overflow.position()]);
                    c = amqp.encode(new WritableBuffer.ByteBufferWrapper(buffer));
                }
                data = buffer.array();

Examples of org.apache.qpid.proton.message.impl.MessageImpl.encode()

         }
         MessageImpl protonMessage = new MessageImpl(header, deliveryAnnotations, messageAnnotations, props, applicationProperties, section, footer);
         protonMessage.setMessageFormat(getMessageFormat(message.getLongProperty(new SimpleString(PROTON_MESSAGE_FORMAT))));
         ByteBuffer buffer = ByteBuffer.wrap(new byte[size]);
         final DroppingWritableBuffer overflow = new DroppingWritableBuffer();
         int c = protonMessage.encode(new CompositeWritableBuffer(new WritableBuffer.ByteBufferWrapper(buffer), overflow));
         if (overflow.position() > 0)
         {
            buffer = ByteBuffer.wrap(new byte[1024 * 4 + overflow.position()]);
            c = protonMessage.encode(new WritableBuffer.ByteBufferWrapper(buffer));
         }

Examples of org.apache.shale.clay.parser.builder.Builder.encode()

            Builder renderer = getBuilder(node);
            ElementBean child = renderer.createElement(node);

            root.addChild(child);
            if (renderer.isChildrenAllowed()) {
                renderer.encode(node, child, child);
            } else {
                renderer.encode(node, child, root);
            }
        }
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.