Package org.apache.pivot.serialization

Examples of org.apache.pivot.serialization.PropertiesSerializer


    // utility method to transform the given Map to Properties,
    // and then to byte array
    protected byte[] mapToPropertiesToBytes(Map<String, Object> testMap2)
            throws IOException, SerializationException {
        Serializer<Map<?, ?>> serializer = new PropertiesSerializer();

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        serializer.writeObject(testMap2, outputStream);
        outputStream.flush();
        outputStream.close();

        String result = outputStream.toString();
View Full Code Here


    public void writeValues() throws IOException, SerializationException {
        log("writeValues()");

        assertNotNull(testMap);

        Serializer<Map<?, ?>> serializer = new PropertiesSerializer();
        log("serializer instance created: " + serializer);

        byte[] testBytes = mapToPropertiesToBytes(testMap);
        assertNotNull(testBytes);
View Full Code Here

        // prepare test data, but without using a static variable
        byte[] testBytes = mapToPropertiesToBytes(testMap);
        assertNotNull(testBytes);


        Serializer<Map<?, ?>> serializer = new PropertiesSerializer();
        log("serializer instance created: " + serializer);

        ByteArrayInputStream inputStream = new ByteArrayInputStream(testBytes);
        @SuppressWarnings("unchecked")
        Map<String, Object> readData = (Map<String, Object>) serializer.readObject(inputStream);
        assertNotNull(readData);

        log("Succesfully Read");
        for (String key : readData) {
            log(key + "=" + readData.get(key));
View Full Code Here

TOP

Related Classes of org.apache.pivot.serialization.PropertiesSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.