(Uri uri)
| 133 | private static native String getWaypointFileForUri(int id, String filename); |
| 134 | |
| 135 | private File getFileForUri(Uri uri) { |
| 136 | String path = uri.getEncodedPath(); |
| 137 | |
| 138 | int i = path.indexOf('/', 1); |
| 139 | |
| 140 | String tag = Uri.decode(path.substring(1, i)); |
| 141 | path = path.substring(i + 1); |
| 142 | |
| 143 | if (tag.equals("waypoints")) { |
| 144 | i = path.indexOf('/', 1); |
| 145 | int id = Integer.parseInt(Uri.decode(path.substring(0, i))); |
| 146 | String name = Uri.decode(path.substring(i + 1)); |
| 147 | String file = getWaypointFileForUri(id, name); |
| 148 | if (file == null) |
| 149 | return null; |
| 150 | return new File(file); |
| 151 | } else |
| 152 | throw new IllegalArgumentException("Unrecognised URI tag"); |
| 153 | } |
| 154 | |
| 155 | private static String[] copyOf(String[] original, int newLength) { |
| 156 | final String[] result = new String[newLength]; |
no test coverage detected