protected void addDataFile(OutputStream out) throws IOException {
   Writer writer = null;
   try {
     writer = new OutputStreamWriter(out, "UTF-8");
   } catch (UnsupportedEncodingException e) {
     throw new RuntimeException(e);
   }
   OsmWriter w =
       OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion());
   layer.data.getReadLock().lock();
   try {
     w.writeLayer(layer);
     w.flush();
   } finally {
     layer.data.getReadLock().unlock();
   }
 }