@Test public void testFileNameExtractionFromUrl() throws IOException { String url1 = "http: assertTrue(MongoUtil.extractFilesNameFromUrl(url1).equalsIgnoreCase("filename.zip")); String url2 = "https: assertTrue(MongoUtil.extractFilesNameFromUrl(url2).equalsIgnoreCase("filename.zip")); String url3 = "https: assertTrue(MongoUtil.extractFilesNameFromUrl(url3).equalsIgnoreCase("filename.json")); String url4 = "https: assertTrue(MongoUtil.extractFilesNameFromUrl(url4).equalsIgnoreCase("filename.json")); String url5 = "https: assertTrue(MongoUtil.extractFilesNameFromUrl(url5).equalsIgnoreCase("filename.json")); }
public static String extractFilesNameFromUrl(String url) throws MalformedURLException { final URL urlObject = new URL(url); String path = urlObject.getPath(); int lastSeparatorIndex = path.lastIndexOf("/"); return path.substring(lastSeparatorIndex > -1 ? lastSeparatorIndex + 1 : 0, path.length()); }
MongoUtil { public static String extractFilesNameFromUrl(String url) throws MalformedURLException { final URL urlObject = new URL(url); String path = urlObject.getPath(); int lastSeparatorIndex = path.lastIndexOf("/"); return path.substring(lastSeparatorIndex > -1 ? lastSeparatorIndex + 1 : 0, path.length()); } }
MongoUtil { public static String extractFilesNameFromUrl(String url) throws MalformedURLException { final URL urlObject = new URL(url); String path = urlObject.getPath(); int lastSeparatorIndex = path.lastIndexOf("/"); return path.substring(lastSeparatorIndex > -1 ? lastSeparatorIndex + 1 : 0, path.length()); }  }
MongoUtil { public static String extractFilesNameFromUrl(String url) throws MalformedURLException { final URL urlObject = new URL(url); String path = urlObject.getPath(); int lastSeparatorIndex = path.lastIndexOf("/"); return path.substring(lastSeparatorIndex > -1 ? lastSeparatorIndex + 1 : 0, path.length()); }  static Object getDBOValue(DBObject dbo, String path); static Object getDBOValue(DBObject dbo, Iterator<String> path); static void setDBOValue(DBObject dbo, String path, Object value); static void setDBOValue(DBObject dbo, Iterator<String> path, Object value); static Set<String> findIndexedGeometries(DBCollection dbc); static Set<String> findIndexedFields(DBCollection dbc); static Set<String> findIndexedFields(DBCollection dbc, String type); static Map<String, Class<?>> findMappableFields(DBCollection dbc); static Map<String, Class<?>> findMappableFields(DBObject dbo); static Class<?> mapBSONObjectToJavaType(Object o); static String extractFilesNameFromUrl(String url); static boolean isZipFile(File file); static boolean isZipFile(String uri); static File extractZipFile(File destDir, File zipFile); }
MongoUtil { public static String extractFilesNameFromUrl(String url) throws MalformedURLException { final URL urlObject = new URL(url); String path = urlObject.getPath(); int lastSeparatorIndex = path.lastIndexOf("/"); return path.substring(lastSeparatorIndex > -1 ? lastSeparatorIndex + 1 : 0, path.length()); }  static Object getDBOValue(DBObject dbo, String path); static Object getDBOValue(DBObject dbo, Iterator<String> path); static void setDBOValue(DBObject dbo, String path, Object value); static void setDBOValue(DBObject dbo, Iterator<String> path, Object value); static Set<String> findIndexedGeometries(DBCollection dbc); static Set<String> findIndexedFields(DBCollection dbc); static Set<String> findIndexedFields(DBCollection dbc, String type); static Map<String, Class<?>> findMappableFields(DBCollection dbc); static Map<String, Class<?>> findMappableFields(DBObject dbo); static Class<?> mapBSONObjectToJavaType(Object o); static String extractFilesNameFromUrl(String url); static boolean isZipFile(File file); static boolean isZipFile(String uri); static File extractZipFile(File destDir, File zipFile);  }