protected Writer initialize(final File f) throws FileNotFoundException, IOException { FileUtils.moveAsideIfExists(f); return new OutputStreamWriter(new GZIPOutputStream( new FastBufferedOutputStream(new FileOutputStream(f),32*1024))); }
/** * Returns a new {@link InputStream} that is sourced from this data. */ default InputStream toInputStream() { return new FastByteArrayInputStream(array(), offset(), length()); }
/** 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.
/** Reads a line into the given byte-array fragment using {@linkplain #ALL_TERMINATORS all terminators}. * * @param array byte array where the next line will be stored. * @param off the first byte to use in {@code array}. * @param len the maximum number of bytes to read. * @return the number of bytes actually placed in {@code array}, or -1 at end of file. * @see #readLine(byte[], int, int, EnumSet) */ public int readLine(final byte[] array, final int off, final int len) throws IOException { return readLine(array, off, len, ALL_TERMINATORS); }
/** 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 storeDoubles(final double array[], final PrintStream stream) { storeDoubles(array, 0, array.length, stream); } /** Stores an array fragment to a file given by a {@link File} 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 loadFloats(final BufferedReader reader, final float[] array) throws IOException { return loadFloats(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 given print stream. * * @param array an array whose elements will be written to {@code stream}. * @param stream a print stream. */ public static void storeFloats(final float array[], final PrintStream stream) { storeFloats(array, 0, array.length, stream); } /** Stores an array fragment to a file given by a {@link File} object.
/** Wraps the given data input stream into an iterator. * * @param dataInput a data input. */ public static IntIterator asIntIterator(final DataInput dataInput) { return new IntDataInputWrapper(dataInput); } /** Wraps a file given by a {@link File} object into an iterator.
/** Wraps the given data input stream into an iterator. * * @param dataInput a data input. */ public static LongIterator asLongIterator(final DataInput dataInput) { return new LongDataInputWrapper(dataInput); } /** Wraps a file given by a {@link File} object into an iterator.
/** 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 storeBytes(final byte array[], final PrintStream stream) { storeBytes(array, 0, array.length, stream); } /** Stores an array fragment to a file given by a {@link File} object.
/** Loads elements from a file given by a filename, storing them in a given array. * * @param filename a filename. * @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 loadShorts(final CharSequence filename, final short[] array) throws IOException { return loadShorts(filename, array, 0, array.length); } /** Stores an array fragment to a given print stream.
/** Wraps the given buffered reader into an iterator. * * @param reader a buffered reader. */ public static ShortIterator asShortIterator(final BufferedReader reader) { return new ShortReaderWrapper(reader); } /** Wraps a file given by a {@link File} object into an iterator.
/** Stores an array to a given data output. * * @param array an array whose elements will be written to {@code dataOutput}. * @param dataOutput a data output. */ public static void storeBytes(final byte array[], final DataOutput dataOutput) throws IOException { write(dataOutput, array, 0, array.length); } /** Stores an array fragment to a file given by a {@link File} object.
/** Creates a new fast buffered output stream by wrapping a given output stream with a given buffer size. * * @param os an output stream to wrap. * @param bufferSize the size in bytes of the internal buffer. */ public FastBufferedOutputStream(final OutputStream os, final int bufferSize) { this(os, new byte[ensureBufferSize(bufferSize)]); }
/** Wraps the given buffered reader into an iterator. * * @param reader a buffered reader. */ public static DoubleIterator asDoubleIterator(final BufferedReader reader) { return new DoubleReaderWrapper(reader); } /** Wraps a file given by a {@link File} object into an iterator.
/** 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 loadBooleans(final File file, final boolean[] array) throws IOException { return loadBooleans(file, array, 0, array.length); } /** Loads elements from a file given by a filename, storing them in a given array.
return new FastBufferedOutputStream(new FileOutputStream(arcFile));
/** 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 storeDoubles(final double array[], final File file) throws IOException { storeDoubles(array, 0, array.length, file); } /** Stores an array to a file given by a pathname.
/** Loads elements from a file given by a filename, storing them in a given array. * * @param filename a filename. * @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 loadFloats(final CharSequence filename, final float[] array) throws IOException { return loadFloats(filename, array, 0, array.length); } /** Stores an array fragment to a given print stream.
/** 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 storeFloats(final float array[], final File file) throws IOException { storeFloats(array, 0, array.length, file); } /** Stores an array to a file given by a pathname.