Package org.cactoos.io
Class InputStreamOf
- java.lang.Object
-
- java.io.InputStream
-
- org.cactoos.io.InputStreamOf
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class InputStreamOf extends InputStream
AnInputStream
that encapsulates other sources of data.There is no thread-safety guarantee.
- Since:
- 0.13
-
-
Constructor Summary
Constructors Constructor Description InputStreamOf(byte[] bytes)
Ctor.InputStreamOf(File file)
Ctor.InputStreamOf(Reader rdr)
Ctor.InputStreamOf(Reader rdr, int max)
Ctor.InputStreamOf(Reader rdr, CharSequence charset)
Ctor.InputStreamOf(Reader rdr, CharSequence charset, int max)
Ctor.InputStreamOf(Reader rdr, Charset charset)
Ctor.InputStreamOf(Reader rdr, Charset cset, int max)
Ctor.InputStreamOf(CharSequence text)
Ctor.InputStreamOf(CharSequence text, CharSequence charset)
Ctor.InputStreamOf(CharSequence text, Charset charset)
Ctor.InputStreamOf(URI uri)
Ctor.InputStreamOf(URL url)
Ctor.InputStreamOf(Path path)
Ctor.InputStreamOf(Bytes bytes)
Ctor.InputStreamOf(Input input)
Ctor.InputStreamOf(Text text)
Ctor.InputStreamOf(Text text, CharSequence charset)
Ctor.InputStreamOf(Text text, Charset charset)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
void
mark(int limit)
boolean
markSupported()
int
read()
int
read(byte[] buffer)
int
read(byte[] buffer, int offset, int length)
void
reset()
long
skip(long num)
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
InputStreamOf
public InputStreamOf(Path path)
Ctor.- Parameters:
path
- The path
-
InputStreamOf
public InputStreamOf(File file)
Ctor.- Parameters:
file
- The file
-
InputStreamOf
public InputStreamOf(URL url)
Ctor.- Parameters:
url
- The URL
-
InputStreamOf
public InputStreamOf(URI uri)
Ctor.- Parameters:
uri
- The URI
-
InputStreamOf
public InputStreamOf(Bytes bytes)
Ctor.- Parameters:
bytes
- The text
-
InputStreamOf
public InputStreamOf(byte[] bytes)
Ctor.- Parameters:
bytes
- The text
-
InputStreamOf
public InputStreamOf(Text text)
Ctor.- Parameters:
text
- The text
-
InputStreamOf
public InputStreamOf(Text text, Charset charset)
Ctor.- Parameters:
text
- The textcharset
- Charset
-
InputStreamOf
public InputStreamOf(Text text, CharSequence charset)
Ctor.- Parameters:
text
- The textcharset
- Charset
-
InputStreamOf
public InputStreamOf(CharSequence text)
Ctor.- Parameters:
text
- The text
-
InputStreamOf
public InputStreamOf(CharSequence text, Charset charset)
Ctor.- Parameters:
text
- The textcharset
- Charset
-
InputStreamOf
public InputStreamOf(CharSequence text, CharSequence charset)
Ctor.- Parameters:
text
- The textcharset
- Charset
-
InputStreamOf
public InputStreamOf(Reader rdr)
Ctor.- Parameters:
rdr
- The reader- Since:
- 0.13.2
-
InputStreamOf
public InputStreamOf(Reader rdr, Charset charset)
Ctor.- Parameters:
rdr
- Readercharset
- Charset- Since:
- 0.13.2
-
InputStreamOf
public InputStreamOf(Reader rdr, CharSequence charset)
Ctor.- Parameters:
rdr
- Readercharset
- Charset- Since:
- 0.13.2
-
InputStreamOf
public InputStreamOf(Reader rdr, Charset cset, int max)
Ctor.- Parameters:
rdr
- Readercset
- Charsetmax
- Buffer size- Since:
- 0.13.2
-
InputStreamOf
public InputStreamOf(Reader rdr, int max)
Ctor.- Parameters:
rdr
- Readermax
- Buffer size- Since:
- 0.13.2
-
InputStreamOf
public InputStreamOf(Reader rdr, CharSequence charset, int max)
Ctor.- Parameters:
rdr
- Readercharset
- Charsetmax
- Buffer size- Since:
- 0.13.2
-
InputStreamOf
public InputStreamOf(Input input)
Ctor.- Parameters:
input
- The input
-
-
Method Detail
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer, int offset, int length) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
skip
public long skip(long num) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
mark
public void mark(int limit)
- Overrides:
mark
in classInputStream
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
-