/** Wraps a file given by a {@link File} object into an iterable object. * * @param file a file. */ public static IntIterable asIntIterable(final File file) { return () -> { try { return asIntIterator(file); } catch(IOException e) { throw new RuntimeException(e); } }; } /** Wraps a file given by a pathname into an iterable object.
/** Loads elements from a given buffered reader, storing them in a given array. * * @param reader a buffered reader. * @param array an array which will be filled with data from {@code reader}. * @return the number of elements actually read from {@code reader} (it might be less than the array length if {@code reader} ends). */ public static int loadInts(final BufferedReader reader, final int[] array) throws IOException { return loadInts(reader, array, 0, array.length); } /** Loads elements from a file given by a {@link File} object, storing them in a given array fragment.
/** Stores an array to a file given by a {@link File} object. * * @param array an array whose elements will be written to {@code filename}. * @param file a file. */ public static void storeInts(final int array[], final File file) throws IOException { storeInts(array, 0, array.length, file); } /** Stores an array to a file given by a pathname.
/** Stores an array to a file given by a pathname. * * @param array an array whose elements will be written to {@code filename}. * @param filename a filename. */ public static void storeLongs(final long array[], final CharSequence filename) throws IOException { storeLongs(array, 0, array.length, filename); } /** Stores the element returned by an iterator to a given print stream.
/** Wraps a file given by a {@link File} object into an iterable object. * * @param file a file. */ public static LongIterable asLongIterable(final File file) { return () -> { try { return asLongIterator(file); } catch(IOException e) { throw new RuntimeException(e); } }; } /** Wraps a file given by a pathname into an iterable object.
/** Wraps a file given by a {@link File} object into an iterable object. * * @param file a file. */ public static FloatIterable asFloatIterable(final File file) { return () -> { try { return asFloatIterator(file); } catch(IOException e) { throw new RuntimeException(e); } }; } /** Wraps a file given by a pathname into an iterable object.
/** Wraps a file given by a {@link File} object into an iterable object. * * @param file a file. */ public static ShortIterable asShortIterable(final File file) { return () -> { try { return asShortIterator(file); } catch(IOException e) { throw new RuntimeException(e); } }; } /** Wraps a file given by a pathname into an iterable object.
/** Wraps a file given by a {@link File} object into an iterable object. * * @param file a file. */ public static DoubleIterable asDoubleIterable(final File file) { return () -> { try { return asDoubleIterator(file); } catch(IOException e) { throw new RuntimeException(e); } }; } /** Wraps a file given by a pathname into an iterable object.
/** Wraps a file given by a pathname into an iterable object. * * @param filename a filename. */ public static ByteIterable asByteIterable(final CharSequence filename) { return () -> { try { return asByteIterator(filename); } catch(IOException e) { throw new RuntimeException(e); } }; } /* Generic definitions */
/** Wraps a file given by a {@link File} object into an iterable object. * * @param file a file. */ public static BooleanIterable asBooleanIterable(final File file) { return () -> { try { return asBooleanIterator(file); } catch(IOException e) { throw new RuntimeException(e); } }; } /** Wraps a file given by a pathname into an iterable object.
/** Stores an array to a given print stream. * * @param array an array whose elements will be written to {@code stream}. * @param stream a print stream. */ public static void storeLongs(final long array[], final PrintStream stream) { storeLongs(array, 0, array.length, stream); } /** Stores an array fragment to a file given by a {@link File} object.
/** Wraps a file given by a pathname into an iterable object. * * @param filename a filename. */ public static LongIterable asLongIterable(final CharSequence filename) { return () -> { try { return asLongIterator(filename); } catch(IOException e) { throw new RuntimeException(e); } }; } /* Generic definitions */
/** Wraps a file given by a pathname into an iterable object. * * @param filename a filename. */ public static FloatIterable asFloatIterable(final CharSequence filename) { return () -> { try { return asFloatIterator(filename); } catch(IOException e) { throw new RuntimeException(e); } }; } }
/** Wraps a file given by a pathname into an iterable object. * * @param filename a filename. */ public static ShortIterable asShortIterable(final CharSequence filename) { return () -> { try { return asShortIterator(filename); } catch(IOException e) { throw new RuntimeException(e); } }; } /* Generic definitions */
/** Wraps a file given by a pathname into an iterable object. * * @param filename a filename. */ public static DoubleIterable asDoubleIterable(final CharSequence filename) { return () -> { try { return asDoubleIterator(filename); } catch(IOException e) { throw new RuntimeException(e); } }; } /* Generic definitions */
/** Wraps a file given by a {@link File} object into an iterable object. * * @param file a file. */ public static ByteIterable asByteIterable(final File file) { return () -> { try { return asByteIterator(file); } catch(IOException e) { throw new RuntimeException(e); } }; } /** Wraps a file given by a pathname into an iterable object.
/** Wraps a file given by a pathname into an iterable object. * * @param filename a filename. */ public static BooleanIterable asBooleanIterable(final CharSequence filename) { return () -> { try { return asBooleanIterator(filename); } catch(IOException e) { throw new RuntimeException(e); } }; } /* Generic definitions */
/** Stores an array to a given print stream. * * @param array an array whose elements will be written to {@code stream}. * @param stream a print stream. */ public static void storeInts(final int array[], final PrintStream stream) { storeInts(array, 0, array.length, stream); } /** Stores an array fragment to a file given by a {@link File} object.
/** Stores an array to a file given by a {@link File} object. * * @param array an array whose elements will be written to {@code filename}. * @param file a file. */ public static void storeLongs(final long array[], final File file) throws IOException { storeLongs(array, 0, array.length, file); } /** Stores an array to a file given by a pathname.
/** Loads elements from a file given by a {@link File} object, storing them in a given array. * * @param file a file. * @param array an array which will be filled with data from the specified file. * @return the number of elements actually read from the given file (it might be less than the array length if the file is too short). */ public static int loadInts(final File file, final int[] array) throws IOException { return loadInts(file, array, 0, array.length); } /** Loads elements from a file given by a filename, storing them in a given array.