final byte[] data = ByteArrayPool.getByteArray(UTF8.encoded(value) + Signatures.getLength( idSizeType ) + 1); data[0] = (byte) ( Signatures.Attr << 0x5 ); data[0] |= idSizeType; data[0] |= (byte) (attributeType << 0x2); Signatures.write( idSizeType, id, data, 1 ); UTF8.encode(value, data, 1 + Signatures.getLength( idSizeType ));
int prefixLen = 0; if (nodeName.needsNamespaceDecl()) { prefixLen = nodeName.getPrefix().length() > 0 ? UTF8.encoded(nodeName.getPrefix()) : 0; } final byte[] data = ByteArrayPool.getByteArray(UTF8.encoded(value) + Signatures.getLength( idSizeType ) + (nodeName.needsNamespaceDecl() ? prefixLen + 4 : 0) + 1); int pos = 0; data[pos] = (byte) ( Signatures.Attr << 0x5 ); data[pos] |= idSizeType; data[pos] |= (byte) (attributeType << 0x2); if(nodeName.needsNamespaceDecl()) data[pos] |= 0x10; Signatures.write( idSizeType, id, data, ++pos ); pos += Signatures.getLength(idSizeType); if(nodeName.needsNamespaceDecl()) { final short nsId = ownerDocument.getSymbols().getNSSymbol(nodeName.getNamespaceURI()); ByteConversion.shortToByte(nsId, data, pos); pos += 2; ByteConversion.shortToByte((short)prefixLen, data, pos); pos += 2; if(nodeName.getPrefix().length() > 0) UTF8.encode(nodeName.getPrefix(), data, pos); pos += prefixLen; } UTF8.encode(value, data, pos);
    public byte[] serialize() {        final short id = ownerDocument.getSymbols().getSymbol( this );        final byte idSizeType = Signatures.getSizeType( id );        final byte[] data = ByteArrayPool.getByteArray(UTF8.encoded(value) +            Signatures.getLength( idSizeType ) +            1);        data[0] = (byte) ( Signatures.Attr << 0x5 );        data[0] |= idSizeType;        data[0] |= (byte) (attributeType << 0x2);        Signatures.write( idSizeType, id, data, 1 );        UTF8.encode(value, data, 1 + Signatures.getLength( idSizeType ));        return data;    }