[Coherence] Using Coherence API to get POF bytes

Posted by Unknown Rabu, 24 Oktober 2012 0 komentar
原文はこちら。
https://blogs.oracle.com/brunoborges/entry/coherence_pof_for_raw_byte

Coherence APIを使ってPOF(Portable Object Format)のオブジェクトのバイト列をプログラムで取り出す方法を質問している人がいたので、こんなコードを思いつきました。非常にクールなAPIの簡単な利用方法がわかると思います。
Oracle® Coherence Java API Reference Release 3.7.1.0
http://docs.oracle.com/cd/E26853_01/coh.371/e22843/index.html
Portable Object Formatの使用
http://docs.oracle.com/cd/E26853_01/coh.371/b65026/api_pof.htm (日本語)
http://docs.oracle.com/cd/E24290_01/coh.371/e22837/api_pof.htm (英語)
SimplePofContext spc = new SimplePofContext();
spc.registerUserType(0, User.class, new UserSerializer());
// consider UserSerializer as an implementation of PofSerializer

User u = new User();
u.setId(21);
u.setName("Some Name");
u.setEmail("some.name@domain.com");

ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutput dataOutput = new DataOutputStream(baos);
BufferOutput bufferOutput = new WrapperBufferOutput(dataOutput);
spc.serialize(bufferOutput, u);

byte[] byteArray = baos.toByteArray();
System.out.println(Arrays.toString(byteArray));
com.tangosol.io.pof
Interface PofSerializer
http://docs.oracle.com/cd/E26853_01/coh.371/e22843/com/tangosol/io/pof/PofSerializer.html

ね、簡単でしょ?
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: [Coherence] Using Coherence API to get POF bytes
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://apk-zipalign.blogspot.com/2012/10/coherence-using-coherence-api-to-get.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of apk zipalign.