Package org.apache.qpid.proton.jni

Examples of org.apache.qpid.proton.jni.pn_bytes_t


    @Override
    @ProtonCEquivalent("pn_data_put_symbol")
    public void putSymbol(final Symbol symbol)
    {
        byte[] data = symbol.toString().getBytes(ASCII_CHARSET);
        pn_bytes_t bytes_t = new pn_bytes_t();
        Proton.pn_bytes_from_array(bytes_t, data);
        Proton.pn_data_put_symbol(_impl, bytes_t);
        //TODO
    }
View Full Code Here


    @Override
    @ProtonCEquivalent("pn_data_get_binary")
    public Binary getBinary()
    {
        pn_bytes_t b = Proton.pn_data_get_binary(_impl);

        return b == null ? null : new Binary(Proton.pn_bytes_to_array(b));
    }
View Full Code Here

    {
        final boolean noProperties = _properties == null;

        Proton.pn_message_set_id(_impl, convertToAtom(noProperties ? null : _properties.getMessageId()));

        pn_bytes_t userId = new pn_bytes_t();;
        if(!noProperties && _properties.getUserId() != null)
        {
            final Binary binary = _properties.getUserId();
            byte[] bytes = new byte[binary.getLength()];
            System.arraycopy(binary.getArray(),binary.getArrayOffset(),bytes,0,binary.getLength());
View Full Code Here

    @Override
    @ProtonCEquivalent("pn_data_get_string")
    public String getString()
    {
        pn_bytes_t b = Proton.pn_data_get_string(_impl);
        return b == null ? null : new String(Proton.pn_bytes_to_array(b), UTF8_CHARSET);
    }
View Full Code Here

    @Override
    @ProtonCEquivalent("pn_data_get_symbol")
    public Symbol getSymbol()
    {
        pn_bytes_t b = Proton.pn_data_get_symbol(_impl);
        return b == null ? null : Symbol.valueOf(new String(Proton.pn_bytes_to_array(b), ASCII_CHARSET));
    }
View Full Code Here

            ByteBuffer buf = ByteBuffer.wrap(bytes);
            UUID uuid = (UUID) o;
            buf.putLong(uuid.getMostSignificantBits());
            buf.putLong(uuid.getLeastSignificantBits());
            atom.setType(pn_type_t.PN_UUID);
            pn_bytes_t val = new pn_bytes_t();
            Proton.pn_bytes_from_array(val, bytes);
            atom.getU().setAs_bytes(val);
            val.delete();
        }
//PN_BINARY
        else if(o instanceof byte[] || o instanceof Binary)
        {
            byte[] bytes = (o instanceof byte[]) ? (byte[])o : ((Binary)o).getArray();
            atom.setType(pn_type_t.PN_BINARY);
            pn_bytes_t val = new pn_bytes_t();
            Proton.pn_bytes_from_array(val, bytes);
            atom.getU().setAs_bytes(val);
            val.delete();
        }
//PN_STRING
        else if(o instanceof String)
        {
            byte[] bytes = ((String)o).getBytes(UTF8_CHARSET);
            atom.setType(pn_type_t.PN_STRING);
            pn_bytes_t val = new pn_bytes_t();
            Proton.pn_bytes_from_array(val, bytes);
            atom.getU().setAs_bytes(val);
            val.delete();
        }
//PN_SYMBOL
        else if(o instanceof Symbol)
        {
            byte[] bytes = ((Symbol)o).toString().getBytes(ASCII_CHARSET);
            atom.setType(pn_type_t.PN_STRING);
            pn_bytes_t val = new pn_bytes_t();
            Proton.pn_bytes_from_array(val, bytes);
            atom.getU().setAs_bytes(val);
            val.delete();
        }
//PN_DESCRIBED
        // TODO
//PN_ARRAY
        // TODO
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.jni.pn_bytes_t

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.