public class MediatingInputStream extends InputStream
InputStream providing a utility by which a client can access the
payload of a Field without needing to take actions depending on whether the full payload of the
field is locally available or it is transfered using a transport directive of IBuffer.TransportDirective.Partial.
Its function makes sure that additional payload is requested whenever more data is requested. To avoid
unnecessary data traffic, additional payload requests are made whenever the client needs to access more
data than what is already available. If a client knows beforehand that he is going to need the full payload
of the field, an alternative would be to make a request through Field.makeAvailable() to make sure the full
payload is available once the invocation is completed. The amount of data that is transfered and made available
on every request is subject to the specific FieldDefinition and more particularly to the value set using
FieldDefinition.setChunkSize(int). If the data is already available, then no remote request is needed
or performed.| Modifier | Constructor and Description |
|---|---|
protected |
MediatingInputStream(Field field)
Creates a new instance and uses
Field.getInputStream() to retrieve the field's input stream |
protected MediatingInputStream(Field field) throws IOException, GRS2RecordMediationException
Field.getInputStream() to retrieve the field's input streamfield - the field for which the payload data needs mediationIOException - The field's input stream could not be providedGRS2RecordMediationException - No field providedpublic boolean markSupported()
markSupported in class InputStreamInputStream.markSupported()public void mark(int readlimit)
mark in class InputStreamInputStream.mark(int)public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionInputStream.close()public int available()
throws IOException
available in class InputStreamIOExceptionInputStream.available()public int read()
throws IOException
Before forwarding the request to the underlying InputStream, it is checked if there is one byte
available in the underlying InputStream and if there isn't, a request for more data is send
read in class InputStreamIOExceptionInputStream.read()public int read(byte[] b)
throws IOException
Before forwarding the request to the underlying InputStream, it is checked if there are b.length bytes
available in the underlying InputStream and if there aren't, a request for more data is send
read in class InputStreamIOExceptionInputStream.read(byte[])public int read(byte[] b,
int off,
int len)
throws IOException
Before forwarding the request to the underlying InputStream, it is checked if there are len bytes
available in the underlying InputStream and if there aren't, a request for more data is send
read in class InputStreamIOExceptionInputStream.read(byte[], int, int)public void reset()
throws IOException
reset in class InputStreamIOExceptionInputStream.reset()public long skip(long n)
throws IOException
skip in class InputStreamIOExceptionInputStream.skip(long)Copyright © 2014. All Rights Reserved.