Ignore:
Timestamp:
2009-04-06T20:18:48+02:00 (15 years ago)
Author:
framm
Message:
  • Major redesign of how JOSM talks to the OSM server. Connections now all go through a new OsmApi class that finds out which version the server uses. JOSM should now be able to handle 0.5 and 0.6 without configuration change. Config options osm-server.version and osm-server.additional-versions now obsolete. Handling of error and cancel situations might still need some improvement.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/XmlWriter.java

    r1169 r1523  
    22package org.openstreetmap.josm.io;
    33
    4 import java.io.OutputStream;
    5 import java.io.OutputStreamWriter;
    64import java.io.PrintWriter;
    7 import java.io.UnsupportedEncodingException;
    85import java.util.HashMap;
    96
     
    1512public class XmlWriter {
    1613
    17     /**
    18      * The interface to write the data into an Osm stream
    19      * @author immanuel.scholz
    20      */
    21     public static interface OsmWriterInterface {
    22         void header(PrintWriter out);
    23         void write(PrintWriter out);
    24         void footer(PrintWriter out);
    25     }
    26 
    27 
    28     protected XmlWriter(PrintWriter out) {
     14    protected PrintWriter out;
     15   
     16    public XmlWriter(PrintWriter out) {
    2917        this.out = out;
    3018    }
    31 
     19   
    3220    /**
    3321     * Encode the given string in XML1.0 format.
     
    4937
    5038    /**
    51      * Write the header and start tag, then call the runnable to add all real tags and finally
    52      * "closes" the xml by writing the footer.
    53      */
    54     public static void output(OutputStream outStream, OsmWriterInterface outputWriter) {
    55         PrintWriter out;
    56         try {
    57             out = new PrintWriter(new OutputStreamWriter(outStream, "UTF-8"));
    58         } catch (UnsupportedEncodingException e) {
    59             throw new RuntimeException(e);
    60         }
    61         out.println("<?xml version='1.0' encoding='UTF-8'?>");
    62         outputWriter.header(out);
    63         outputWriter.write(out);
    64         outputWriter.footer(out);
    65         out.flush();
    66         out.close();
    67     }
    68 
    69     /**
    7039     * The output writer to save the values to.
    7140     */
    72     protected final PrintWriter out;
    7341    final private static HashMap<Character, String> encoding = new HashMap<Character, String>();
    7442    static {
Note: See TracChangeset for help on using the changeset viewer.