Package net.oauth.client
Class ExcerptInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- net.oauth.client.ExcerptInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ExcerptInputStream extends FilterInputStream
A decorator that retains a copy of the first few bytes of data.
-
-
Field Summary
Fields Modifier and Type Field Description static byte[]ELLIPSISA marker that's appended to the excerpt if it's less than the complete stream.-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description ExcerptInputStream(InputStream in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static byte[]copyAll(InputStream from, OutputStream into)byte[]getExcerpt()The first few bytes of data, plus ELLIPSIS if there are more bytes.intread()intread(byte[] b)intread(byte[] b, int offset, int length)-
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ExcerptInputStream
public ExcerptInputStream(InputStream in)
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-
getExcerpt
public byte[] getExcerpt() throws IOExceptionThe first few bytes of data, plus ELLIPSIS if there are more bytes.- Throws:
IOException
-
read
public int read(byte[] b, int offset, int length) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
public int read() throws IOException- Overrides:
readin classFilterInputStream- Throws:
IOException
-
copyAll
public static byte[] copyAll(InputStream from, OutputStream into) throws IOException
- Returns:
- an excerpt from the data copied.
- Throws:
IOException
-
-