Examples of StreamException


Examples of com.thoughtworks.xstream.io.StreamException

                source.setEncoding(encoding);
            }
            final Document document = documentBuilder.parse(source);
            return new DomReader(document, getNameCoder());
        } catch (final FactoryConfigurationError e) {
            throw new StreamException(e);
        } catch (final ParserConfigurationException e) {
            throw new StreamException(e);
        } catch (final SAXException e) {
            throw new StreamException(e);
        } catch (final IOException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

    @Override
    public HierarchicalStreamWriter createWriter(final OutputStream out) {
        try {
            return createWriter(encoding != null ? new OutputStreamWriter(out, encoding) : new OutputStreamWriter(out));
        } catch (final UnsupportedEncodingException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

        try {
            final Class<? extends XMLInputFactory> staxInputFactory = JVM.getStaxInputFactory();
            if (staxInputFactory != null) {
                return staxInputFactory.newInstance();
            } else {
                throw new StreamException("Java runtime has no standard XMLInputFactory implementation.", exception);
            }
        } catch (final InstantiationException e) {
            exception = e;
        } catch (final IllegalAccessException e) {
            exception = e;
        } catch (final ClassNotFoundException e) {
            exception = e;
        }
        throw new StreamException("Cannot create standard XMLInputFactory instance of Java runtime.", exception);
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

        try {
            final Class<? extends XMLOutputFactory> staxOutputFactory = JVM.getStaxOutputFactory();
            if (staxOutputFactory != null) {
                return staxOutputFactory.newInstance();
            } else {
                throw new StreamException("Java runtime has no standard XMLOutputFactory implementation.", exception);
            }
        } catch (final InstantiationException e) {
            exception = e;
        } catch (final IllegalAccessException e) {
            exception = e;
        } catch (final ClassNotFoundException e) {
            exception = e;
        }
        throw new StreamException("Cannot create standard XMLOutputFactory instance of Java runtime.", exception);
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

            switch (c) {
            case '\0':
                if (mode == XML_QUIRKS) {
                    writer.write(NULL);
                } else {
                    throw new StreamException("Invalid character 0x0 in XML stream");
                }
                break;
            case '&':
                writer.write(AMP);
                break;
            case '<':
                writer.write(LT);
                break;
            case '>':
                writer.write(GT);
                break;
            case '"':
                writer.write(QUOT);
                break;
            case '\'':
                writer.write(APOS);
                break;
            case '\r':
                writer.write(CR);
                break;
            case '\t':
            case '\n':
                if (!isAttribute) {
                    writer.write(c);
                    break;
                }
                //$FALL-THROUGH$
            default:
                if (Character.isDefined(c) && !Character.isISOControl(c)) {
                    if (mode != XML_QUIRKS) {
                        if (c > '\ud7ff' && c < '\ue000') {
                            throw new StreamException("Invalid character 0x"
                                + Integer.toHexString(c)
                                + " in XML stream");
                        }
                    }
                    writer.write(c);
                } else {
                    if (mode == XML_1_0) {
                        if (c < 9 || c == '\u000b' || c == '\u000c' || c == '\u000e' || c >= '\u000f' && c <= '\u001f') {
                            throw new StreamException("Invalid character 0x"
                                + Integer.toHexString(c)
                                + " in XML 1.0 stream");
                        }
                    }
                    if (mode != XML_QUIRKS) {
                        if (c == '\ufffe' || c == '\uffff') {
                            throw new StreamException("Invalid character 0x"
                                + Integer.toHexString(c)
                                + " in XML stream");
                        }
                    }
                    writer.write("&#x");
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

        try {
            final SAXReader reader = new SAXReader();
            final Document document = reader.read(text);
            return new Dom4JReader(document, getNameCoder());
        } catch (final DocumentException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

        try {
            final SAXReader reader = new SAXReader();
            final Document document = reader.read(in);
            return new Dom4JReader(document, getNameCoder());
        } catch (final DocumentException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

        try {
            final SAXReader reader = new SAXReader();
            final Document document = reader.read(in);
            return new Dom4JReader(document, getNameCoder());
        } catch (final DocumentException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

        try {
            final SAXReader reader = new SAXReader();
            final Document document = reader.read(in);
            return new Dom4JReader(document, getNameCoder());
        } catch (final DocumentException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

Examples of com.thoughtworks.xstream.io.StreamException

        try {
            final XmlPullParser parser = createParser();
            parser.setInput(in);
            return new XppDomReader(XppDom.build(parser), getNameCoder());
        } catch (final XmlPullParserException e) {
            throw new StreamException(e);
        } catch (final IOException e) {
            throw new StreamException(e);
        }
    }
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.