| Constructor and Description |
|---|
Gobble(InputStream in)
Gets the contents of an input stream.
|
Gobble(Path file)
Gets the contents of a file.
|
Gobble(Reader reader)
Gets the contents of a reader.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
asByteArray()
Gets the stream contents as a byte array.
|
String |
asString()
Gets the stream contents as a string.
|
String |
asString(Charset charset)
Gets the stream contents as a string.
|
public Gobble(InputStream in)
in - the input streampublic String asString() throws IOException
Reader was passed into this class's constructor, this method
decodes the stream data using the system's default character encoding.IOException - if there was a problem reading from the streampublic String asString(Charset charset) throws IOException
charset - the character set to decode the stream data with (this
parameter is ignored if a Reader was passed into this class's
constructor)IOException - if there was a problem reading from the streampublic byte[] asByteArray() throws IOException
IOException - if there was a problem reading from the streamIllegalStateException - if a Reader object was passed into
this class's constructorCopyright © 2012–2023 Michael Angstadt. All rights reserved.