public class Inputs extends Object
Modifier and Type | Method and Description |
---|---|
static Input<ByteBuffer,IOException> |
byteBuffer(File source,
int bufferSize)
Read a file using ByteBuffer of a given size.
|
static Input<ByteBuffer,IOException> |
byteBuffer(InputStream source,
int bufferSize)
Read an inputstream using ByteBuffer of a given size.
|
static <T,SenderThrowableType extends Throwable> |
combine(Iterable<Input<T,SenderThrowableType>> inputs)
Combine many Input into one single Input.
|
static <T> Input<T,RuntimeException> |
iterable(Iterable<T> iterable)
Create an Input that takes its items from the given Iterable.
|
static Input<ByteBuffer,IOException> |
output(Visitor<OutputStream,IOException> outputVisitor,
int bufferSize)
Create an Input that allows a Visitor to write to an OutputStream.
|
static Input<String,IOException> |
text(File source)
Read lines from a UTF-8 encoded textfile.
|
static Input<String,IOException> |
text(File source,
String encoding)
Read lines from a textfile with the given encoding.
|
static Input<String,RuntimeException> |
text(Reader source)
Read lines from a Reader.
|
static Input<String,RuntimeException> |
text(String source)
Read lines from a String.
|
static Input<String,IOException> |
text(URL source)
Read lines from a textfile at a given URL.
|
public static Input<String,RuntimeException> text(String source)
source
- linespublic static Input<String,RuntimeException> text(Reader source)
source
- linespublic static Input<String,IOException> text(File source)
source
- textfile with lines separated by \n characterpublic static Input<String,IOException> text(File source, String encoding)
source
- textfile with lines separated by \n characterencoding
- encoding of file, e.g. "UTF-8"public static Input<String,IOException> text(URL source)
source
- textfile with lines separated by \n characterpublic static Input<ByteBuffer,IOException> byteBuffer(File source, int bufferSize)
source
- The file to be read.bufferSize
- The size of the byte array.public static Input<ByteBuffer,IOException> byteBuffer(InputStream source, int bufferSize)
source
- The InputStream to be read.bufferSize
- The size of the byte array.public static <T,SenderThrowableType extends Throwable> Input<T,SenderThrowableType> combine(Iterable<Input<T,SenderThrowableType>> inputs)
T
- The item type of the InputSenderThrowableType
- The Throwable that might be thrown by the Inputs.inputs
- An Iterable of Input instances to be combined.public static <T> Input<T,RuntimeException> iterable(Iterable<T> iterable)
T
- The item type of the Inputiterable
- The Iterable to be used as an Input.public static Input<ByteBuffer,IOException> output(Visitor<OutputStream,IOException> outputVisitor, int bufferSize)
outputVisitor
- The OutputStream Visitor that will be backing the Input ByteBuffer.bufferSize
- The buffering size.