/** * Appends the specified collection to this set of collections. * * @param c The collection to append to this set of collections. * @return This object (for method chaining). */ public MultiSet<E> append(Collection<E> c) { assertFieldNotNull(c, "c"); l.add(c); return this; }
/** * Appends the specified iterator to this list of iterators. * * @param iterator The iterator to append. * @return This object (for method chaining). */ public MultiIterable<E> append(Iterator<E> iterator) { assertFieldNotNull(iterator, "iterator"); this.iterators.add(iterator); return this; }
/** * Appends the specified iterator to this list of iterators. * * @param iterator The iterator to append. * @return This object (for method chaining). */ public MultiIterable<E> append(Iterator<E> iterator) { assertFieldNotNull(iterator, "iterator"); this.iterators.add(iterator); return this; }
/** * Appends the specified collection to this set of collections. * * @param c The collection to append to this set of collections. * @return This object (for method chaining). */ public MultiSet<E> append(Collection<E> c) { assertFieldNotNull(c, "c"); l.add(c); return this; }
/** * Appends the specified collection to this set of collections. * * @param c The collection to append to this set of collections. * @return This object (for method chaining). */ public MultiSet<E> append(Collection<E> c) { assertFieldNotNull(c, "c"); l.add(c); return this; }
/** * Appends the specified iterator to this list of iterators. * * @param iterator The iterator to append. * @return This object (for method chaining). */ public MultiIterable<E> append(Iterator<E> iterator) { assertFieldNotNull(iterator, "iterator"); this.iterators.add(iterator); return this; }
private String sname(String key) { assertFieldNotNull(key, "key"); int i = key.indexOf('/'); if (i == -1) return ""; return key.substring(0, i); }
private String sname(String key) { assertFieldNotNull(key, "key"); int i = key.indexOf('/'); if (i == -1) return ""; return key.substring(0, i); }
private String sname(String key) { assertFieldNotNull(key, "key"); int i = key.indexOf('/'); if (i == -1) return ""; return key.substring(0, i); }
private IOPipe(Object input, Object output) { assertFieldNotNull(input, "input"); assertFieldNotNull(output, "output"); if (input instanceof InputStream || input instanceof Reader || input instanceof File || input instanceof byte[] || input instanceof CharSequence || input == null) this.input = input; else illegalArg("Invalid input class type. Must be one of the following: InputStream, Reader, CharSequence, byte[], File"); if (output instanceof OutputStream || output instanceof Writer) this.output = output; else illegalArg("Invalid output class type. Must be one of the following: OutputStream, Writer"); }
private IOPipe(Object input, Object output) { assertFieldNotNull(input, "input"); assertFieldNotNull(output, "output"); if (input instanceof InputStream || input instanceof Reader || input instanceof File || input instanceof byte[] || input instanceof CharSequence || input == null) this.input = input; else illegalArg("Invalid input class type. Must be one of the following: InputStream, Reader, CharSequence, byte[], File"); if (output instanceof OutputStream || output instanceof Writer) this.output = output; else illegalArg("Invalid output class type. Must be one of the following: OutputStream, Writer"); }
private String section(String section) { assertFieldNotNull(section, "section"); if (isEmpty(section)) return ""; return section; }
/** * Same as {@link #mkdirs(String, boolean)} but uses String path. * * @param path The path of the directory to create. Must not be <jk>null</jk> * @param clean If <jk>true</jk>, deletes the contents of the directory if it already exists. * @return The directory. */ public static File mkdirs(String path, boolean clean) { assertFieldNotNull(path, "path"); return mkdirs(new File(path), clean); }
/** * Same as {@link #mkdirs(String, boolean)} but uses String path. * * @param path The path of the directory to create. Must not be <jk>null</jk> * @param clean If <jk>true</jk>, deletes the contents of the directory if it already exists. * @return The directory. */ public static File mkdirs(String path, boolean clean) { assertFieldNotNull(path, "path"); return mkdirs(new File(path), clean); }
private String section(String section) { assertFieldNotNull(section, "section"); if (isEmpty(section)) return ""; return section; }
private String section(String section) { assertFieldNotNull(section, "section"); if (isEmpty(section)) return ""; return section; }
/** * Same as {@link #mkdirs(String, boolean)} but uses String path. * * @param path The path of the directory to create. Must not be <jk>null</jk> * @param clean If <jk>true</jk>, deletes the contents of the directory if it already exists. * @return The directory. */ public static File mkdirs(String path, boolean clean) { assertFieldNotNull(path, "path"); return mkdirs(new File(path), clean); }
private IOPipe(Object input, Object output) { assertFieldNotNull(input, "input"); assertFieldNotNull(output, "output"); if (input instanceof InputStream || input instanceof Reader || input instanceof File || input instanceof byte[] || input instanceof CharSequence || input == null) this.input = input; else illegalArg("Invalid input class type. Must be one of the following: InputStream, Reader, CharSequence, byte[], File"); if (output instanceof OutputStream || output instanceof Writer) this.output = output; else illegalArg("Invalid output class type. Must be one of the following: OutputStream, Writer"); }
/** * Writes the contents of the specified <code>InputStream</code> to the specified file. * * @param out The file to write the output to. * @param in The input stream to pipe from. * @return The number of characters written to the file. * @throws IOException */ public static int write(File out, InputStream in) throws IOException { assertFieldNotNull(out, "out"); assertFieldNotNull(in, "in"); try (OutputStream os = new FileOutputStream(out)) { return IOPipe.create(in, os).run(); } }
/** * Writes the contents of the specified <code>Reader</code> to the specified file. * * @param out The file to write the output to. * @param in The reader to pipe from. * @return The number of characters written to the file. * @throws IOException */ public static int write(File out, Reader in) throws IOException { assertFieldNotNull(out, "out"); assertFieldNotNull(in, "in"); try (Writer w = FileWriterBuilder.create(out).build()) { return IOPipe.create(in, w).run(); } }