MCPcopy Create free account
hub / github.com/XCSoar/XCSoar / getFileForUri

Method getFileForUri

android/src/FileProvider.java:135–153  ·  view source on GitHub ↗
(Uri uri)

Source from the content-addressed store, hash-verified

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];

Callers 3

queryMethod · 0.95
getTypeMethod · 0.95
openFileMethod · 0.95

Calls 2

getWaypointFileForUriMethod · 0.95
equalsMethod · 0.80

Tested by

no test coverage detected