Package org.apache.pivot.serialization

Examples of org.apache.pivot.serialization.JSONSerializer.readObject()


        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


            && clipboardContent.containsText()) {
            String json = null;
            JSONSerializer jsonSerializer = new JSONSerializer();
            try {
                json = clipboardContent.getText();
                setValue(jsonSerializer.readObject(new StringReader(json)));
            } catch (IOException exception) {
                Prompt.prompt(exception.getMessage(), window);
            } catch(SerializationException exception) {
                String message = "Serialization exception at line "
                    + jsonSerializer.getLineNumber() + ": "
View Full Code Here

                JSONSerializer jsonSerializer = new JSONSerializer();
                FileInputStream fileInputStream = null;
                try {
                    try {
                        fileInputStream = new FileInputStream(file);
                        setValue(jsonSerializer.readObject(fileInputStream));
                    } finally {
                        if (fileInputStream != null) {
                            fileInputStream.close();
                        }
                    }
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.err.println(exception);
                }
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

            (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

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.