Return-Path: X-Original-To: apmail-avro-user-archive@www.apache.org Delivered-To: apmail-avro-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F8229ED1 for ; Mon, 14 May 2012 15:09:12 +0000 (UTC) Received: (qmail 75299 invoked by uid 500); 14 May 2012 15:09:12 -0000 Delivered-To: apmail-avro-user-archive@avro.apache.org Received: (qmail 75245 invoked by uid 500); 14 May 2012 15:09:11 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 75234 invoked by uid 99); 14 May 2012 15:09:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2012 15:09:11 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=SPF_PASS,SUBJ_OBFU_PUNCT_FEW X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [81.20.131.2] (HELO muelheim.netport.de) (81.20.131.2) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 May 2012 15:09:04 +0000 Received: (qmail 13743 invoked from network); 14 May 2012 17:08:35 +0200 Received: from sea1.sea-gmbh.com (89.1.3.82) by muelheim.netport.de with ESMTPSA (DHE-RSA-AES256-SHA encrypted, authenticated); 14 May 2012 17:08:35 +0200 Received: from no-name-248.sea.intern ([192.168.0.248]:55939) by sea1.sea-gmbh.com with esmtp (Exim 4.76) (envelope-from ) id 1STwt6-0005LW-31 for user@avro.apache.org; Mon, 14 May 2012 17:08:41 +0200 X-CTCH-RefID: str=0001.0A0B0208.4FB11FF8.0240,ss=1,re=0.000,fgs=0 Message-ID: <4FB11FFA.1080400@sea-gmbh.com> Date: Mon, 14 May 2012 17:08:42 +0200 From: =?ISO-8859-15?Q?Stefan_Sch=F6nig?= User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: user@avro.apache.org Subject: How to encode/decode java.util.Properties Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit I'm not able to Encode/Decode a class from the Standard-JDK ( java.util.Properties). The inserted key/value pair is not available after decode. Any idea what goint wrong?!? Thank in advance! Code of the application: import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Properties; import org.apache.avro.*; import org.apache.avro.io.*; import org.apache.avro.reflect.*; public class AvroPropertiesTest { public static void main(String[] args) throws IOException { ReflectData reflectData = ReflectData.get(); Schema schema = reflectData.getSchema(Properties.class); ByteArrayOutputStream os = new ByteArrayOutputStream(); Encoder e = EncoderFactory.get().binaryEncoder(os, null); Properties properties = new Properties(); properties.put("Hello", "World"); System.out.println("properties: " + properties); DatumWriter writer = new ReflectDatumWriter(schema); writer.write(properties, e); e.flush(); ReflectDatumReader reader = new ReflectDatumReader( schema); Decoder decoder = DecoderFactory.get().binaryDecoder(os.toByteArray(), null); Properties decodedProperties = (Properties) reader.read(null, decoder); System.out.println("decodedProperties: " + decodedProperties); } } -- This email was Anti Virus checked by Astaro Security Gateway. http://www.astaro.com