/*
 * Copyright (C) 2005-2022 Sebastiano Vigna
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package it.unimi.dsi.fastutil.io;

import static it.unimi.dsi.fastutil.BigArrays.SEGMENT_MASK;
import static it.unimi.dsi.fastutil.BigArrays.length;
import static it.unimi.dsi.fastutil.BigArrays.start;
import static it.unimi.dsi.fastutil.BigArrays.segment;
import static it.unimi.dsi.fastutil.BigArrays.ensureOffsetLength;

import java.io.*;
import java.util.*;
import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.longs.*;
import it.unimi.dsi.fastutil.doubles.*;
import it.unimi.dsi.fastutil.booleans.*;
import it.unimi.dsi.fastutil.bytes.*;
import it.unimi.dsi.fastutil.shorts.*;
import it.unimi.dsi.fastutil.floats.*;

/** Provides static methods to perform easily textual I/O.
 *
 * <p>This class fills a gap in the Java API: a natural operation on sequences
 * of primitive elements is to load or store them in textual form. This format
 * makes files humanly readable.
 *
 * <p>For each primitive type, this class provides methods that read elements
 * from a {@link BufferedReader} or from a filename (which will be opened
 * using a buffer of {@link #BUFFER_SIZE} bytes) into an array. Analogously,
 * there are methods that store the content of an array (fragment) or the
 * elements returned by an iterator to a {@link PrintStream} or to a given
 * filename.
 *
 * <p>Finally, there are useful wrapper methods that {@linkplain #asIntIterator(CharSequence)
 * exhibit a file as a type-specific iterator}.
 *
 * <p>Note that, contrarily to the binary case, there is no way to
 * {@linkplain BinIO#loadInts(CharSequence) load from a file without providing an array}. You can
 * easily work around the problem as follows:
 * <pre>
 * array = IntIterators.unwrap(TextIO.asIntIterator("foo"));
 * </pre>
 *
 * @since 4.4
 */

public class TextIO {

	private TextIO() {}

	/** The size of the buffer used for all I/O on files. */
	public static final int BUFFER_SIZE = 8 * 1024;

#include "src/it/unimi/dsi/fastutil/io/IntTextIOFragment.h"
#include "src/it/unimi/dsi/fastutil/io/LongTextIOFragment.h"
#include "src/it/unimi/dsi/fastutil/io/DoubleTextIOFragment.h"
#include "src/it/unimi/dsi/fastutil/io/BooleanTextIOFragment.h"
#include "src/it/unimi/dsi/fastutil/io/ByteTextIOFragment.h"
#include "src/it/unimi/dsi/fastutil/io/ShortTextIOFragment.h"
#include "src/it/unimi/dsi/fastutil/io/FloatTextIOFragment.h"

}
