Package pivot.serialization

Examples of pivot.serialization.JSONSerializer.readObject()


        }

        JSONSerializer serializer = new JSONSerializer(charset);
        Map<String, Object> resourceMap = null;
        try {
            resourceMap = (Map<String, Object>) serializer.readObject(in);
        } finally {
            in.close();
        }

        return resourceMap;
View Full Code Here


        JSONSerializer jsonSerializer = new JSONSerializer();

        for (int i = 0, n = testStrings.length; i < n; i++) {
            try {
                System.out.println("Input: " + testStrings[i]);
                Object object = jsonSerializer.readObject(new StringReader(testStrings[i]));
                System.out.println("Object: " + object);
                StringWriter writer = new StringWriter();
                jsonSerializer.writeObject(object, writer);

                System.out.println("Output: " + writer);
View Full Code Here

        JSONSerializer serializer = new JSONSerializer("ISO-8859-1");
        InputStream inputStream = JSONSerializerTest.class.getResourceAsStream("json_serializer_test.json");

        Object root = null;
        try {
            root = serializer.readObject(inputStream);
        } catch(Exception exception) {
            System.out.println(exception);
        }

        if (root != null) {
View Full Code Here

          public void buttonPressed(Button button) {
            JSONSerializer serializer = new JSONSerializer();
            InputStream inputStream = getClass().getResourceAsStream("contact.json");

            try {
                form.load((Map<String, Object>)serializer.readObject(inputStream));
                sourceLabel.setText("JSON");
            } catch(Exception exception) {
              System.out.println(exception);
            }
View Full Code Here

        try {
            InputStream inputStream = location.openStream();

            try {
                JSONSerializer serializer = new JSONSerializer();
                Map<String, ?> properties = (Map<String, ?>)serializer.readObject(inputStream);

                font = Font.decode((String)properties.get("font"));

                List<String> colorCodes = (List<String>)properties.get("colors");
                colors = new Color[colorCodes.getLength() * 3];
 
View Full Code Here

            (Map<String, Object>)ApplicationContext.getResourceCache().get(styles);

        if (cachedStyles == null) {
            JSONSerializer jsonSerializer = new JSONSerializer();
            cachedStyles =
                (Map<String, Object>)jsonSerializer.readObject(styles.openStream());

            ApplicationContext.getResourceCache().put(styles, cachedStyles);
        }

        setStyles(cachedStyles);
View Full Code Here

        }

        JSONSerializer serializer = new JSONSerializer(charset);
        Map<String, Object> resourceMap = null;
        try {
            resourceMap = (Map<String, Object>) serializer.readObject(in);
        } finally {
            in.close();
        }

        return resourceMap;
View Full Code Here

        throws IOException, ServletException {
        ServletInputStream inputStream = request.getInputStream();
        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            Object value = jsonSerializer.readObject(inputStream);
            jsonSerializer.writeObject(value, System.out);
            response.setStatus(201);
            response.setHeader("Location", request.getPathInfo() +"#101");
        } catch(SerializationException exception) {
            throw new ServletException(exception);
View Full Code Here

        throws IOException, ServletException {
        ServletInputStream inputStream = request.getInputStream();
        JSONSerializer jsonSerializer = new JSONSerializer();

        try {
            Object value = jsonSerializer.readObject(inputStream);
            jsonSerializer.writeObject(value, System.out);
            response.setStatus(200);
        } catch(SerializationException exception) {
            throw new ServletException(exception);
        }
View Full Code Here

        JSONSerializer jsonSerializer = new JSONSerializer();

        for (int i = 0, n = testStrings.length; i < n; i++) {
            try {
                System.out.println("Input: " + testStrings[i]);
                Object object = jsonSerializer.readObject(new StringReader(testStrings[i]));
                System.out.println("Object: " + object);
                StringWriter writer = new StringWriter();
                jsonSerializer.writeObject(object, writer);

                System.out.println("Output: " + writer);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.