public class Readables extends Object
CharReadable instances.
There are support for compressed files as well for those methods accepting a File argument.
| Modifier and Type | Field and Description |
|---|---|
static CharReadable |
EMPTY |
| Modifier and Type | Method and Description |
|---|---|
static char[] |
extractFirstLineFrom(CharReadable source)
Extracts the first line, i.e characters until the first newline or end of stream.
|
static CharReadable |
files(Charset charset,
File... files) |
static RawIterator<CharReadable,IOException> |
individualFiles(Charset charset,
File... files) |
static <IN,OUT> RawIterator<OUT,IOException> |
iterator(ThrowingFunction<IN,OUT,IOException> converter,
IN... items) |
static CharReadable |
wrap(InputStream stream,
String sourceName,
Charset charset) |
static CharReadable |
wrap(InputStream stream,
String sourceName,
Charset charset,
long length)
Wraps a
InputStream in a CharReadable. |
static CharReadable |
wrap(Reader reader,
long length)
Wraps a
Reader in a CharReadable. |
static CharReadable |
wrap(String data) |
public static final CharReadable EMPTY
public static CharReadable wrap(InputStream stream, String sourceName, Charset charset) throws IOException
IOExceptionpublic static CharReadable wrap(InputStream stream, String sourceName, Charset charset, long length) throws IOException
InputStream in a CharReadable.stream - Reader to wrap.sourceName - name or description of the source of the stream.charset - Charset to use for reading.length - total number of bytes provided by the reader.CharReadable for the Reader.IOException - on I/O error.public static CharReadable wrap(String data)
public static CharReadable wrap(Reader reader, long length)
Reader in a CharReadable.
Remember that the Object.toString() must provide a description of the data source.reader - Reader to wrap.length - total number of bytes provided by the reader.CharReadable for the Reader.public static RawIterator<CharReadable,IOException> individualFiles(Charset charset, File... files)
public static CharReadable files(Charset charset, File... files) throws IOException
IOException@SafeVarargs public static <IN,OUT> RawIterator<OUT,IOException> iterator(ThrowingFunction<IN,OUT,IOException> converter, IN... items)
public static char[] extractFirstLineFrom(CharReadable source) throws IOException
source - CharReadable to read from.IOException - on I/O reading error.Copyright © 2016–2021 MWARE SOLUTIONS. All rights reserved.