Package com.thoughtworks.xstream.io

Examples of com.thoughtworks.xstream.io.HierarchicalStreamDriver


        WMSLayer newLayer = null;

        if (formatExtension.equalsIgnoreCase("xml")) {
            newLayer = (WMSLayer) xs.fromXML(is);
        } else if (formatExtension.equalsIgnoreCase("json")) {
            HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
            HierarchicalStreamReader hsr = driver.createReader(is);
            // See http://jira.codehaus.org/browse/JETTISON-48
            StringWriter writer = new StringWriter();
            new HierarchicalStreamCopier().copy(
                    hsr, new PrettyPrintWriter(writer));
            writer.close();
View Full Code Here


     * The code below is a hack: it treats the json string as text, then
     * converts it to the intermediate xml and then deserializes that
     * into the SeedRequest object.
     */
    private String convertJson(String entityText) throws IOException {
        HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
        StringReader reader = new StringReader(entityText);
        HierarchicalStreamReader hsr = driver.createReader(reader);
        StringWriter writer = new StringWriter();
        new HierarchicalStreamCopier().copy(hsr, new PrettyPrintWriter(
                writer));
        writer.close();
        return writer.toString();
View Full Code Here

    /*
     * create a driver that wires into a standard driver, and updates the stack
     * position.
     */
    HierarchicalStreamDriver driver = new StackDriver(new XppDriver(), writerStack, configuration.getNameSpaces());
    /*
     * Create an interface class mapper that understands class hierarchy for
     * single items
     */
    for (XStreamConfiguration.ConverterSet c : MAPPER_SCOPES) {
View Full Code Here

    /*
     * create a driver that wires into a standard driver, and updates the stack
     * position.
     */
    HierarchicalStreamDriver driver = new StackDriver(new XppDriver(), writerStack, configuration.getNameSpaces());
    /*
     * Create an interface class mapper that understands class hierarchy for
     * single items
     */
    for (XStreamConfiguration.ConverterSet c : MAPPER_SCOPES) {
View Full Code Here

    /*
     * create a driver that wires into a standard driver, and updates the stack
     * position.
     */
    HierarchicalStreamDriver driver = new StackDriver(new XppDriver(), writerStack, configuration.getNameSpaces());
    /*
     * Create an interface class mapper that understands class hierarchy for
     * single items
     */
    for (XStreamConfiguration.ConverterSet c : MAPPER_SCOPES) {
View Full Code Here

        comments.put(
                "passiveExternalAddress",
                "the address the server will claim to be listening on in the PASV reply.\n"
                        + " Useful when the server is behind a NAT firewall and the client sees a different address than the server is using.");

        HierarchicalStreamDriver streamDriver = new CommentingStaxWriter(comments);
        XStream xStream = new XStream(streamDriver);
        xStream.alias("ftp", FTPConfig.class);
        return xStream;
    }
View Full Code Here

        comments.put(
                "passiveExternalAddress",
                "the address the server will claim to be listening on in the PASV reply.\n"
                        + " Useful when the server is behind a NAT firewall and the client sees a different address than the server is using.");

        HierarchicalStreamDriver streamDriver = new CommentingStaxWriter(comments);
        XStream xStream = new XStream(streamDriver);
        xStream.alias("ftp", FTPConfig.class);
        return xStream;
    }
View Full Code Here

        try {
            if (formatExtension.equalsIgnoreCase("xml")) {
                newLayer = (TileLayer) xs.fromXML(is);
            } else if (formatExtension.equalsIgnoreCase("json")) {
                HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
                HierarchicalStreamReader hsr = driver.createReader(is);
                // See http://jira.codehaus.org/browse/JETTISON-48
                StringWriter writer = new StringWriter();
                new HierarchicalStreamCopier().copy(hsr, new PrettyPrintWriter(writer));
                writer.close();
                newLayer = (TileLayer) xs.fromXML(writer.toString());
View Full Code Here

     *
     * The code below is a hack: it treats the json string as text, then converts it to the
     * intermediate xml and then deserializes that into the SeedRequest object.
     */
    private String convertJson(String entityText) throws IOException {
        HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
        StringReader reader = new StringReader(entityText);
        HierarchicalStreamReader hsr = driver.createReader(reader);
        StringWriter writer = new StringWriter();
        new HierarchicalStreamCopier().copy(hsr, new PrettyPrintWriter(writer));
        writer.close();
        return writer.toString();
    }
View Full Code Here

    private DiskQuotaConfig fromJSON(Representation entity) throws IOException {

        final String text = entity.getText();

        HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();

        XStream xStream = new XStream(driver);

        xStream = ConfigLoader.getConfiguredXStream(xStream);
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.HierarchicalStreamDriver

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.