Package com.thoughtworks.xstream.io

Examples of com.thoughtworks.xstream.io.StreamException


    @Override
    public void close() {
        try {
            in.close();
        } catch (final XMLStreamException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here


    @Override
    public HierarchicalStreamReader createReader(final Reader xml) {
        try {
            return createStaxReader(createParser(xml));
        } catch (final XMLStreamException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

    @Override
    public HierarchicalStreamReader createReader(final InputStream in) {
        try {
            return createStaxReader(createParser(in));
        } catch (final XMLStreamException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

                        // ignore
                    }
                }
            };
        } catch (final XMLStreamException e) {
            throw new StreamException(e);
        } catch (final IOException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

                        // ignore
                    }
                }
            };
        } catch (final XMLStreamException e) {
            throw new StreamException(e);
        } catch (final FileNotFoundException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

    @Override
    public HierarchicalStreamWriter createWriter(final Writer out) {
        try {
            return createStaxWriter(getOutputFactory().createXMLStreamWriter(out));
        } catch (final XMLStreamException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

    @Override
    public HierarchicalStreamWriter createWriter(final OutputStream out) {
        try {
            return createStaxWriter(getOutputFactory().createXMLStreamWriter(out));
        } catch (final XMLStreamException e) {
            throw new StreamException(e);
        }
    }
View Full Code Here

        if ("null@null".equals(key)) {
            return null;
        }
        final int idx = key.indexOf('@');
        if (idx < 0) {
            throw new StreamException("Not a valid key: " + key);
        }
        final Class<?> type = getMapper().realClass(key.substring(0, idx));
        final Converter converter = getConverterLookup().lookupConverterForType(type);
        if (converter instanceof SingleValueConverter) {
            final SingleValueConverter svConverter = (SingleValueConverter)converter;
            @SuppressWarnings("unchecked")
            final K k = (K)svConverter.fromString(key.substring(idx + 1));
            return k;
        } else {
            throw new StreamException("No SingleValueConverter for type " + type.getName() + " available");
        }
    }
View Full Code Here

        final Converter converter = getConverterLookup().lookupConverterForType(type);
        if (converter instanceof SingleValueConverter) {
            final SingleValueConverter svConverter = (SingleValueConverter)converter;
            return getMapper().serializedClass(type) + '@' + escape(svConverter.toString(key)) + ".xml";
        } else {
            throw new StreamException("No SingleValueConverter for type " + type.getName() + " available");
        }
    }
View Full Code Here

        switch (firstToken.getType()) {
        case Token.TYPE_START_NODE:
            depthState.setName(idRegistry.get(firstToken.getId()));
            break;
        default:
            throw new StreamException("Expected StartNode");
        }
        while (true) {
            final Token nextToken = readToken();
            switch (nextToken.getType()) {
            case Token.TYPE_ATTRIBUTE:
                depthState.addAttribute(idRegistry.get(nextToken.getId()), nextToken.getValue());
                break;
            case Token.TYPE_VALUE:
                depthState.setValue(nextToken.getValue());
                break;
            case Token.TYPE_END_NODE:
                depthState.setHasMoreChildren(false);
                pushBack(nextToken);
                return;
            case Token.TYPE_START_NODE:
                depthState.setHasMoreChildren(true);
                pushBack(nextToken);
                return;
            default:
                throw new StreamException("Unexpected token " + nextToken);
            }
        }
    }
View Full Code Here

TOP

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

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.