/** * Get the file or directory name (the last element of the path). * This method is similar to Java 7 <code>java.nio.file.Path.getName</code>. * * @param path the directory and file name * @return just the file name */ public static String getName(String path) { return FilePath.get(path).getName(); }
@Override public ArrayList<FilePath> newDirectoryStream() { List<FilePath> list = getBase().newDirectoryStream(); ArrayList<FilePath> newList = New.arrayList(); for (FilePath f : list) { if (!f.getName().endsWith(PART_SUFFIX)) { newList.add(wrap(f)); } } return newList; }
/** * Get the file or directory name (the last element of the path). * This method is similar to Java 7 <code>java.nio.file.Path.getName</code>. * * @param path the directory and file name * @return just the file name */ public static String getName(String path) { return FilePath.get(path).getName(); }
/** * Get the file or directory name (the last element of the path). * This method is similar to Java 7 <code>java.nio.file.Path.getName</code>. * * @param path the directory and file name * @return just the file name */ public static String getName(String path) { return FilePath.get(path).getName(); }
@Override public void connectionMade(final String name, final Connection connection) { final FilePath filePath = FilePath.get(resource); try (final InputStream inputStream = filePath.newInputStream(); final Statement statement = connection.createStatement(); final ByteArrayOutputStream out = new ByteArrayOutputStream(Math.max(32, inputStream.available())); ) { copyToOutputStream(inputStream, out); statement.execute(convertToString(out.toByteArray())); } catch (IOException e) { throw new IllegalArgumentException(String.format("Could not read SQL from file path \"%s\"", filePath.getName()), e); } catch (SQLException e) { throw new IllegalArgumentException(String.format("Could not run SQL script from file path \"%s\"", filePath.getName()), e); } }
@Override public ArrayList<FilePath> newDirectoryStream() { List<FilePath> list = getBase().newDirectoryStream(); ArrayList<FilePath> newList = New.arrayList(); for (int i = 0, size = list.size(); i < size; i++) { FilePath f = list.get(i); if (!f.getName().endsWith(PART_SUFFIX)) { newList.add(wrap(f)); } } return newList; }
@Override public void connectionMade(final String name, final Connection connection) { final FilePath filePath = FilePath.get(resource); try (final InputStream inputStream = filePath.newInputStream(); final Statement statement = connection.createStatement(); final ByteArrayOutputStream out = new ByteArrayOutputStream(Math.max(32, inputStream.available())); ) { copyToOutputStream(inputStream, out); statement.execute(convertToString(out.toByteArray())); } catch (IOException e) { throw new IllegalArgumentException(String.format("Could not read SQL from file path \"%s\"", filePath.getName()), e); } catch (SQLException e) { throw new IllegalArgumentException(String.format("Could not run SQL script from file path \"%s\"", filePath.getName()), e); } }
@Override public ArrayList<FilePath> newDirectoryStream() { List<FilePath> list = getBase().newDirectoryStream(); ArrayList<FilePath> newList = New.arrayList(); for (int i = 0, size = list.size(); i < size; i++) { FilePath f = list.get(i); if (!f.getName().endsWith(PART_SUFFIX)) { newList.add(wrap(f)); } } return newList; }