/* (non-Javadoc)
@see net.timewalker.ffmq4.network.packet.AbstractPacket#serializeTo(net.timewalker.ffmq4.utils.RawDataOutputStream)
506062
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
        out.writeNullableUTF(userName);
        out.writeNullableUTF(password);
        out.writeNullableUTF(clientID);
    }
842827
@Override
	protected void serializeTo(RawDataBuffer out)
    {
        super.serializeTo(out);
        out.writeInt(browserId.asInt());
        DestinationSerializer.serializeTo(queue, out);
        out.writeNullableUTF(messageSelector);
    }
150969
private String _serialize(Object object, Set<Object> done) throws ConverterException {
	String rtn;
	deep++;
	// NULL
	if (object == null) {
	    rtn = goIn() + "<null/>";
	    deep--;
	    return rtn;
	}
	// String
	if (object instanceof String) {
	    rtn = goIn() + "<string>" + XMLUtil.escapeXMLString(object.toString()) + "</string>";
	    deep--;
	    return rtn;
	}
	// Number
	if (object instanceof Number) {
	    rtn = goIn() + "<number>" + ((Number) object).doubleValue() + "</number>";
	    deep--;
	    return rtn;
	}
	// Boolean
	if (object instanceof Boolean) {
	    rtn = goIn() + "<boolean value=" + del + ((Boolean) object).booleanValue() + del + "/>";
	    deep--;
	    return rtn;
	}
	// DateTime
	if (object instanceof DateTime) {
	    rtn = _serializeDateTime((DateTime) object);
	    deep--;
	    return rtn;
	}
	// Date
	if (object instanceof Date) {
	    rtn = _serializeDate((Date) object);
	    deep--;
	    return rtn;
	}
	// Date
	if (Decision.isCastableToBinary(object, false)) {
	    rtn = _serializeBinary(Caster.toBinary(object, null));
	    deep--;
	    return rtn;
	}

	Object raw = LazyConverter.toRaw(object);
	if (done.contains(raw)) {
	    rtn = goIn() + "<null/>";
	    deep--;
	    return rtn;
	}

	done.add(raw);
	try {
	    // Component
	    if (object instanceof Component) {
		rtn = _serializeComponent((Component) object, done);
		deep--;
		return rtn;
	    }
	    // Struct
	    if (object instanceof Struct) {
		rtn = _serializeStruct((Struct) object, done);
		deep--;
		return rtn;
	    }
	    // Map
	    if (object instanceof Map) {
		rtn = _serializeMap((Map) object, done);
		deep--;
		return rtn;
	    }
	    // Array
	    if (object instanceof Array) {
		rtn = _serializeArray((Array) object, done);
		deep--;
		return rtn;
	    }
	    // List
	    if (object instanceof List) {
		rtn = _serializeList((List) object, done);
		deep--;
		return rtn;
	    }
	    // Query
	    if (object instanceof Query) {
		rtn = _serializeQuery((Query) object, done);
		deep--;
		return rtn;
	    }
	}
	finally {
	    done.remove(raw);
	}
	// Others
	rtn = "<struct type=" + del + "L" + object.getClass().getName() + ";" + del + "></struct>";
	deep--;
	return rtn;
    }
1355537
public void writeTo(final PacketOutputStream os) throws IOException {
    os.write(QUOTE);
    os.write(dateByteFormat());
    os.write(QUOTE);
  }
177472
public void serialize(final DataOutput pOutput) throws TTIOException {
        try {
            pOutput.writeInt(IConstants.ATTRIBUTE);
            mDel.serialize(pOutput);
            mNameDel.serialize(pOutput);
            mValDel.serialize(pOutput);
        } catch (final IOException exc) {
            throw new TTIOException(exc);
        }
    }
788634
public void writeTo(OutputStream out) throws IOException
    {
        int sz=size();

        if (sz<=AJP13ResponsePacket.__MAX_BUF)
            super.writeTo(out);
        else
        {
            int offset=preReserve();
            int data=sz-AJP13ResponsePacket.__DATA_HDR;

            while (data>AJP13ResponsePacket.__MAX_DATA)
            {
                _packet.setDataSize(AJP13ResponsePacket.__MAX_BUF-AJP13ResponsePacket.__HDR_SIZE);
                if (offset>0)
                    System.arraycopy(_buf,0,_buf,offset,AJP13ResponsePacket.__DATA_HDR);
                out.write(_buf,offset,AJP13ResponsePacket.__MAX_BUF);

                data-=AJP13ResponsePacket.__MAX_DATA;
                offset+=AJP13ResponsePacket.__MAX_DATA;
            }

            int len=data+AJP13ResponsePacket.__DATA_HDR;
            _packet.setDataSize(len-AJP13ResponsePacket.__HDR_SIZE);
            if (offset>0)
                System.arraycopy(_buf,0,_buf,offset,AJP13ResponsePacket.__DATA_HDR);
            out.write(_buf,offset,len);
        }
    }
445771
public static byte[] serialize(final Serializable object) {
        val outBytes = new ByteArrayOutputStream();
        serialize(object, outBytes);
        return outBytes.toByteArray();
    }
83206
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
        super.unserializeFrom(in);
        sessionId = new IntegerID(in.readInt());
        consumerId = new IntegerID(in.readInt());
        message = MessageSerializer.unserializeFrom(in, false);
        donePrefetching = in.readBoolean();
    }
1205926
public static void writeObject(Serializable toSave, OutputStream writeTo) {
        try {
            ObjectOutputStream os = new ObjectOutputStream(writeTo);
            os.writeObject(toSave);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
226984
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
        super.unserializeFrom(in);
        sessionId = new IntegerID(in.readInt());   
    }
508526
@Override
	public void writeTo(T t, CodedOutputStream out) throws IOException {
		for (FieldInfo fieldInfo : fieldInfos) {
			Object value = FieldUtils.getField(t, fieldInfo.getField());
			if (value != null) {
				writeTo(fieldInfo, value, out);
			}
		}

	}
192361
private static void serialize(Serializable object, OutputStream output) throws IOException {
        BufferedOutputStream bos = new BufferedOutputStream(output);
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(object);
        bos.flush();
    }
863702
public void writeTo(OutputStream out) throws IOException {
        if (!(out instanceof DataOutput)) {
            out = new DataOutputStream(out);
        }

        writeTo((DataOutput)out);

        out.flush();
    }
778439
public void serialize(final OutputStream out) throws IOException {
    final Writer writer = new BufferedWriter(new OutputStreamWriter(out));
    for (final Map.Entry<String, String> entry : this.multiMap.entries()) {
      writer.write(
          entry.getKey() + IOUtils.TAB_DELIMITER + entry.getValue() + "\n");
    }
    writer.flush();
  }
206423
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
    	super.unserializeFrom(in);
    	consumerId = new IntegerID(in.readInt());
    }
343906
@Override
    public <T> T readDataAsObject() throws IOException {
        Data data = readData();
        return data == null ? null : (T) serializationService.toObject(data);
    }
404836
@Override
	protected void serializeTo(RawDataBuffer out)
    {
    	super.serializeTo(out);
    	if (deliveredMessageIDs != null)
        {
    		int len = deliveredMessageIDs.size(); 
            out.writeInt(len);
            for (int i = 0; i < len; i++)
            	out.writeUTF(deliveredMessageIDs.get(i));
        }
        else
            out.writeInt(0);
    }