Examples of CachedFile


Examples of com.mucommander.commons.file.impl.CachedFile

        // changes of size or date could potentially not be reflected when files are being processed but this should
        // not really present a risk.
        AbstractFile tempFile;
        for(int i=0; i<nbFiles; i++) {
            tempFile = files.elementAt(i);
            files.setElementAt((tempFile instanceof CachedFile)?tempFile:new CachedFile(tempFile, true), i);
        }

        if (this.baseSourceFolder!=null)
            this.baseSourceFolder = (getBaseSourceFolder() instanceof CachedFile)?getBaseSourceFolder():new CachedFile(getBaseSourceFolder(), true);

      this.jobProgress = new JobProgress(this);   
    }
View Full Code Here

Examples of com.mucommander.commons.file.impl.CachedFile

     * @param children the current folder's children
     */
    synchronized void setCurrentFolder(AbstractFile folder, AbstractFile children[]) {
        int nbFiles = children.length;

        this.currentFolder = (folder instanceof CachedFile)?folder:new CachedFile(folder, true);

        this.parent = currentFolder.getParent();    // Note: the returned parent is a CachedFile instance
        if(parent!=null) {
            // Pre-fetch the attributes that are used by the table renderer and some actions.
            prefetchCachedFileAttributes(parent);
        }

        // Initialize file indexes and create CachedFile instances to speed up table display and navigation
        this.cachedFiles = children;
        this.fileArrayIndex = new int[nbFiles];
        AbstractFile file;
        for(int i=0; i<nbFiles; i++) {
            file = new CachedFile(children[i], true);

            // Pre-fetch the attributes that are used by the table renderer and some actions.
            prefetchCachedFileAttributes(file);

            cachedFiles[i] = file;
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

                            sources.add((ExtendedSourceEntry) src);
                        }
                    }
                }

                InputStream stream = new CachedFile(url).getInputStream();
                reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));

                String line;
                ExtendedSourceEntry last = null;
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

        return !rlCache.get(ll);
    }

    private static void initialize() {
        leftHandTrafficPolygons = new ArrayList<>();
        try (InputStream is = new CachedFile("resource://data/left-right-hand-traffic.osm").getInputStream()) {
            DataSet data = OsmReader.parseDataSet(is, null);
            for (Way w : data.getWays()) {
                leftHandTrafficPolygons.add(Geometry.getAreaLatLon(w.getNodes()));
            }
        } catch (IOException | IllegalDataException ex) {
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

    @Override
    public void initialize() throws Exception {
        super.initialize();
        if (ENGINE != null) {
            try (Reader reader = new InputStreamReader(
                    new CachedFile("resource://data/validator/opening_hours.js").getInputStream(), StandardCharsets.UTF_8)) {
                ENGINE.eval(reader);
                // fake country/state to not get errors on holidays
                ENGINE.eval("var nominatimJSON = {address: {state: 'Bayern', country_code: 'de'}};");
                ENGINE.eval(
                        "var oh = function (value, mode) {" +
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

        spellCheckKeyData = new HashMap<>();

        String errorSources = "";
        for (String source : Main.pref.getCollection(PREF_SOURCES, DEFAULT_SOURCES)) {
            try (
                InputStream s = new CachedFile(source).getInputStream();
                BufferedReader reader = new BufferedReader(UTFInputStreamReader.create(s));
            ) {
                String okValue = null;
                boolean tagcheckerfile = false;
                boolean ignorefile = false;
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

     * @throws IOException if any I/O error occurs
     * @since 7275
     */
    public synchronized void addMapCSS(String url) throws ParseException, IOException {
        CheckParameterUtil.ensureParameterNotNull(url, "url");
        CachedFile cache = new CachedFile(url);
        try (InputStream s = cache.getInputStream()) {
            List<TagCheck> tagchecks = TagCheck.readMapCSS(new BufferedReader(UTFInputStreamReader.create(s)));
            checks.remove(url);
            checks.putAll(url, tagchecks);
            // Check assertions, useful for development of local files
            if (Main.pref.getBoolean("validator.check_assert_local_rules", false) && Utils.isLocalUrl(url)) {
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

        return all;
    }

    public static Collection<TaggingPreset> readAll(String source, boolean validate) throws SAXException, IOException {
        Collection<TaggingPreset> tp;
        CachedFile cf = new CachedFile(source).setHttpAccept(PRESET_MIME_TYPES);
        try (
            // zip may be null, but Java 7 allows it: https://blogs.oracle.com/darcy/entry/project_coin_null_try_with
            InputStream zip = cf.findZipEntryInputStream("xml", "preset")
        ) {
            if (zip != null) {
                zipIcons = cf.getFile();
            }
            try (InputStreamReader r = new InputStreamReader(zip == null ? cf.getInputStream() : zip, StandardCharsets.UTF_8)) {
                tp = readAll(new BufferedReader(r), validate);
            }
        }
        return tp;
    }
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

     * Load +init "presets" from file
     */
    private static void loadInits() {
        Pattern epsgPattern = Pattern.compile("<(\\d+)>(.*)<>");
        try (
            InputStream in = new CachedFile("resource://data/projection/epsg").getInputStream();
            BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
        ) {
            String line, lastline = "";
            while ((line = r.readLine()) != null) {
                line = line.trim();
View Full Code Here

Examples of org.openstreetmap.josm.io.CachedFile

        }
    }

    @Override
    public InputStream getSourceInputStream() throws IOException {
        CachedFile cf = getCachedFile();
        InputStream zip = cf.findZipEntryInputStream("xml", "style");
        if (zip != null) {
            zipIcons = cf.getFile();
            return zip;
        } else {
            zipIcons = null;
            return cf.getInputStream();
        }
    }
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.