public void unzip(String from, boolean remove) throws IOException { String to = Helper.pruneFileEnd(from); unzip(from, to, remove); }
private void chooseArea(Button button, final Spinner spinner, List<String> nameList, final MySpinnerListener myListener) { final Map<String, String> nameToFullName = new TreeMap<>(); for (String fullName : nameList) { String tmp = Helper.pruneFileEnd(fullName); if (tmp.endsWith("-gh")) tmp = tmp.substring(0, tmp.length() - 3); tmp = AndroidHelper.getFileName(tmp); nameToFullName.put(tmp, fullName); } nameList.clear(); nameList.addAll(nameToFullName.keySet()); ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<>( this, android.R.layout.simple_spinner_dropdown_item, nameList); spinner.setAdapter(spinnerArrayAdapter); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Object o = spinner.getSelectedItem(); if (o != null && o.toString().length() > 0 && !nameToFullName.isEmpty()) { String area = o.toString(); myListener.onSelect(area, nameToFullName.get(area)); } else { myListener.onSelect(null, null); } } }); }
public static void main(String[] args) throws IOException { if (args.length == 0) { throw new IllegalArgumentException("You need to specify the bz2 file!"); } String fromFile = args[0]; if (!fromFile.endsWith(".bz2")) { throw new IllegalArgumentException("You need to specify a bz2 file! But was:" + fromFile); } String toFile = Helper.pruneFileEnd(fromFile); FileInputStream in = new FileInputStream(fromFile); FileOutputStream out = new FileOutputStream(toFile); BZip2CompressorInputStream bzIn = new BZip2CompressorInputStream(in); try { final byte[] buffer = new byte[1024 * 8]; int n = 0; while (-1 != (n = bzIn.read(buffer))) { out.write(buffer, 0, n); } } finally { out.close(); bzIn.close(); } } }
protected Object saveDoInBackground(Void... _ignore) throws Exception { String localFolder = Helper.pruneFileEnd(AndroidHelper.getFileName(downloadURL)); localFolder = new File(mapsFolder, localFolder + "-gh").getAbsolutePath(); log("downloading & unzipping " + downloadURL + " to " + localFolder); AndroidDownloader downloader = new AndroidDownloader(); downloader.setTimeout(30000); downloader.downloadAndUnzip(downloadURL, localFolder, new ProgressListener() { @Override public void update(long val) { publishProgress((int) val); } }); return null; }
throw new IllegalArgumentException("If no graph.location is provided you need to specify an OSM file."); graphHopperFolder = pruneFileEnd(dataReaderFile) + "-gh";
public void unzip( String from, boolean remove ) throws IOException { String to = Helper.pruneFileEnd(from); unzip(from, to, remove); }
public void unzip(String from, boolean remove) throws IOException { String to = Helper.pruneFileEnd(from); unzip(from, to, remove); }
public void unzip(String from, boolean remove) throws IOException { String to = Helper.pruneFileEnd(from); unzip(from, to, remove); }
throw new IllegalArgumentException("You need to specify an OSM file."); graphHopperFolder = Helper.pruneFileEnd(dataReaderFile) + "-gh";
throw new IllegalArgumentException("You need to specify an OSM file."); graphHopperFolder = Helper.pruneFileEnd(osmFile) + "-gh";
throw new IllegalArgumentException("If no graph.location is provided you need to specify an OSM file."); graphHopperFolder = pruneFileEnd(dataReaderFile) + "-gh";