Package org.semarglproject.rdf

Examples of org.semarglproject.rdf.ParseException


        if (cause instanceof ParseException) {
            error(RDFa.ERROR, cause.getMessage());
            return (ParseException) cause;
        }
        error(RDFa.ERROR, e.getMessage());
        return new ParseException(e);
    }
View Full Code Here


    @Override
    public void startStream() throws ParseException {
        try {
            handler.startRDF();
        } catch(RDFHandlerException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

    @Override
    public void endStream() throws ParseException {
        try {
            handler.endRDF();
        } catch(RDFHandlerException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

    public final void process(File file, String baseUri) throws ParseException {
        FileReader reader;
        try {
            reader = new FileReader(file);
        } catch (FileNotFoundException e) {
            throw new ParseException(e);
        }
        try {
            process(reader, null, baseUri);
        } finally {
            closeQuietly(reader);
View Full Code Here

    public final void process(String uri, String baseUri) throws ParseException {
        URL url;
        try {
            url = new URL(uri);
        } catch (MalformedURLException e) {
            throw new ParseException(e);
        }
        try {
            URLConnection urlConnection = url.openConnection();
            String mimeType = urlConnection.getContentType();
            InputStream inputStream = urlConnection.getInputStream();
            try {
                process(inputStream, mimeType, baseUri);
            } finally {
                closeQuietly(inputStream);
            }
        } catch (IOException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

            int read;
            while ((read = bufferedReader.read(buffer)) != -1) {
                sink.process(buffer, 0, read);
            }
        } catch (IOException e) {
            throw new ParseException(e);
        } finally {
            BaseStreamProcessor.closeQuietly(bufferedReader);
        }
    }
View Full Code Here

    @Override
    public void process(Reader reader, String mimeType, String baseUri) throws ParseException {
        try {
            initXmlReader();
        } catch (SAXException e) {
            throw new ParseException("Can not instantinate XMLReader", e);
        }
        try {
            sink.setBaseUri(baseUri);
            xmlReader.parse(new InputSource(reader));
        } catch (SAXException e) {
            ParseException wrappedException = sink.processException(e);
            try {
                sink.endDocument();
            } catch (SAXException e2) {
                // do nothing
            }
            throw wrappedException;
        } catch (IOException e) {
            throw new ParseException(e);
        }
    }
View Full Code Here

        if (bufferSize >= BATCH_SIZE) {
            try {
                try {
                    writer.write(buffer.toString());
                } catch (IOException e) {
                    throw new ParseException(e);
                }
            } catch (ParseException e) {
                // do nothing
            }
            buffer = new StringBuilder(BATCH_SIZE);
View Full Code Here

        if (writer == null) {
            if (file != null) {
                try {
                    writer = new OutputStreamWriter(new FileOutputStream(file), charset);
                } catch (FileNotFoundException e) {
                    throw new ParseException(e);
                }
            } else if (outputStream != null) {
                writer = new OutputStreamWriter(outputStream, charset);
            }
        }
View Full Code Here

        bufferSize = BATCH_SIZE;
        writeBuffer();
        try {
            writer.flush();
        } catch (IOException e) {
            throw new ParseException(e);
        }
        if (closeOnEndStream) {
            if (writer != null) {
                closeQuietly(writer);
                writer = null;
View Full Code Here

TOP

Related Classes of org.semarglproject.rdf.ParseException

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.