All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hprose.io.serialize.UUIDSerializer Maven / Gradle / Ivy

/**********************************************************\
|                                                          |
|                          hprose                          |
|                                                          |
| Official WebSite: http://www.hprose.com/                 |
|                   http://www.hprose.org/                 |
|                                                          |
\**********************************************************/
/**********************************************************\
 *                                                        *
 * UUIDSerializer.java                                    *
 *                                                        *
 * UUID serializer class for Java.                        *
 *                                                        *
 * LastModified: Aug 6, 2016                              *
 * Author: Ma Bingyao                   *
 *                                                        *
\**********************************************************/

package hprose.io.serialize;

import static hprose.io.HproseTags.TagClosebrace;
import static hprose.io.HproseTags.TagGuid;
import static hprose.io.HproseTags.TagOpenbrace;
import java.io.IOException;
import java.io.OutputStream;
import java.util.UUID;

public final class UUIDSerializer extends ReferenceSerializer {

    public final static UUIDSerializer instance = new UUIDSerializer();

    @Override
    public final void serialize(Writer writer, UUID uuid) throws IOException {
        super.serialize(writer, uuid);
        OutputStream stream = writer.stream;
        stream.write(TagGuid);
        stream.write(TagOpenbrace);
        stream.write(ValueWriter.getAscii(uuid.toString()));
        stream.write(TagClosebrace);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy