Package slash.common.io

Examples of slash.common.io.NotClosingUnderlyingInputStream


    public void read(InputStream source, CompactCalendar startDate, ParserContext<BaseRoute> parserContext) throws Exception {
        ZipInputStream zip = new ZipInputStream(source);
        try {
            ZipEntry entry;
            while ((entry = zip.getNextEntry()) != null) {
                NotClosingUnderlyingInputStream buffer = new NotClosingUnderlyingInputStream(new BufferedInputStream(zip));
                int size = (int) entry.getSize() + 1;
                buffer.mark(size);
                List<NavigationFormat> formats = getReadFormatsPreferredByExtension(Files.getExtension(entry.getName()));
                parserContext.parse(buffer, startDate, formats);
                zip.closeEntry();
            }
        } catch (IOException e) {
View Full Code Here


    }

    public ParserResult read(File source, List<NavigationFormat> formats) throws IOException {
        log.info("Reading '" + source.getAbsolutePath() + "' by " + formats.size() + " formats");
        FileInputStream fis = new FileInputStream(source);
        NotClosingUnderlyingInputStream buffer = new NotClosingUnderlyingInputStream(new BufferedInputStream(fis));
        buffer.mark((int) source.length() + 1);
        try {
            return read(buffer, (int) source.length(), getStartDate(source), formats);
        } finally {
            buffer.closeUnderlyingInputStream();
        }
    }
View Full Code Here

    }

    private ParserResult read(InputStream source, int readBufferSize, CompactCalendar startDate,
                              List<NavigationFormat> formats) throws IOException {
        log.fine("Reading '" + source + "' with a buffer of " + readBufferSize + " bytes by " + formats.size() + " formats");
        NotClosingUnderlyingInputStream buffer = new NotClosingUnderlyingInputStream(new BufferedInputStream(source));
        buffer.mark(readBufferSize + 1);
        try {
            ParserContext<BaseRoute> context = new InternalParserContext<BaseRoute>();
            internalRead(buffer, startDate, formats, context);
            return createResult(context);
        } finally {
            buffer.closeUnderlyingInputStream();
        }
    }
View Full Code Here

            // replace CWD with current working directory for easier testing
            urlString = urlString.replace("CWD", new File(".").getCanonicalPath()).replace(separatorChar, '/');
            URL url = new URL(urlString);
            int readBufferSize = getSize(url);
            log.info("Reading '" + url + "' with a buffer of " + readBufferSize + " bytes");
            NotClosingUnderlyingInputStream buffer = new NotClosingUnderlyingInputStream(new BufferedInputStream(url.openStream()));
            buffer.mark(readBufferSize + 1);
            try {
                internalRead(buffer, getStartDate(url), getReadFormats(), this);
            } finally {
                buffer.closeUnderlyingInputStream();
            }
        }
View Full Code Here

    public void read(InputStream source, CompactCalendar startDate, ParserContext<KmlRoute> context) throws Exception {
        ZipInputStream zip = new ZipInputStream(source);
        try {
            while ((zip.getNextEntry()) != null) {
                delegate.read(new NotClosingUnderlyingInputStream(zip), startDate, context);
                zip.closeEntry();
            }
        } finally {
            zip.close();
        }
View Full Code Here

TOP

Related Classes of slash.common.io.NotClosingUnderlyingInputStream

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.