Ignore:
Timestamp:
2006-10-08T03:20:53+02:00 (18 years ago)
Author:
imi
Message:
  • enhanced plugin system to integrate osmarender
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/plugins/Plugin.java

    r153 r154  
    11package org.openstreetmap.josm.plugins;
    22
     3import java.io.FileNotFoundException;
     4import java.io.FileOutputStream;
     5import java.io.IOException;
     6import java.io.InputStream;
    37import java.net.URL;
    48import java.net.URLClassLoader;
     
    6266         */
    6367        public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {}
     68
     69        /**
     70         * Copies the ressource 'from' to the file in the plugin directory named 'to'.
     71         */
     72        public void copy(String from, String to) throws FileNotFoundException, IOException {
     73        FileOutputStream out = new FileOutputStream(getPluginDir()+to);
     74        InputStream in = getClass().getResourceAsStream(from);
     75        byte[] buffer = new byte[8192];
     76        for(int len = in.read(buffer); len > 0; len = in.read(buffer))
     77                out.write(buffer, 0, len);
     78        in.close();
     79        out.close();
     80    }
    6481}
Note: See TracChangeset for help on using the changeset viewer.