public abstract class ProxyInputStream
extends java.io.FilterInputStream
FilterInputStream, by passing all method calls on to the proxied stream, not changing which methods are called.
It is an alternative base class to FilterInputStream to increase reusability, because FilterInputStream changes the methods being called,
such as read(byte[]) to read(byte[], int, int).
In addition, this class allows you to:
beforeRead(int)afterRead(int)handleIOException(IOException)unwrap() itself| Constructor and Description |
|---|
ProxyInputStream(java.io.InputStream proxy)
Constructs a new ProxyInputStream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Invokes the delegate's
InputStream.available() method. |
void |
close()
Invokes the delegate's
InputStream.close() method. |
void |
mark(int readLimit)
Invokes the delegate's
InputStream.mark(int) method. |
boolean |
markSupported()
Invokes the delegate's
InputStream.markSupported() method. |
int |
read()
Invokes the delegate's
InputStream.read() method unless the stream is closed. |
int |
read(byte[] b)
Invokes the delegate's
InputStream.read(byte[]) method. |
int |
read(byte[] b,
int off,
int len)
Invokes the delegate's
InputStream.read(byte[], int, int) method. |
void |
reset()
Invokes the delegate's
InputStream.reset() method. |
ProxyInputStream |
setReference(java.io.InputStream in)
Sets the underlying input stream.
|
long |
skip(long n)
Invokes the delegate's
InputStream.skip(long) method. |
java.io.InputStream |
unwrap()
Unwraps this instance by returning the underlying
InputStream. |
public ProxyInputStream(java.io.InputStream proxy)
proxy - the InputStream to proxy.public int available()
throws java.io.IOException
InputStream.available() method.available in class java.io.FilterInputStreamjava.io.IOException - if an I/O error occurs.public void close()
throws java.io.IOException
InputStream.close() method.close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOException - if an I/O error occurs.public void mark(int readLimit)
InputStream.mark(int) method.mark in class java.io.FilterInputStreamreadLimit - read ahead limit.public boolean markSupported()
InputStream.markSupported() method.public int read()
throws java.io.IOException
InputStream.read() method unless the stream is closed.read in class java.io.FilterInputStreamEOF if we reached the end of stream.java.io.IOException - if an I/O error occurs.public int read(byte[] b)
throws java.io.IOException
InputStream.read(byte[]) method.read in class java.io.FilterInputStreamb - the buffer to read the bytes into.EOF if we reached the end of stream.java.io.IOException - public int read(byte[] b,
int off,
int len)
throws java.io.IOException
InputStream.read(byte[], int, int) method.read in class java.io.FilterInputStreamb - the buffer to read the bytes into.off - The start offset.len - The number of bytes to read.EOF if we reached the end of stream.java.io.IOException - public void reset()
throws java.io.IOException
InputStream.reset() method.reset in class java.io.FilterInputStreamjava.io.IOException - if this stream has not been marked or if the mark has been invalidated.public ProxyInputStream setReference(java.io.InputStream in)
in - The input stream to set in FilterInputStream.in.public long skip(long n)
throws java.io.IOException
InputStream.skip(long) method.skip in class java.io.FilterInputStreamn - the number of bytes to skip.java.io.IOException - if the stream does not support seek, or if some other I/O error occurs.public java.io.InputStream unwrap()
InputStream.
Use with caution; useful to query the underlying InputStream.
InputStream.Copyright © 2010 - 2025 Adobe. All Rights Reserved