abstract class EXTDTAReaderInputStream
extends java.io.InputStream
This class can be used to stream LOBs from Network client to the Network server.
To be able to correctly stream data from the client without reading the while value up front, a trailing Derby-specific status byte was introduced (version 10.6). It is used by the client to tell the server if the data it received was valid, or if it detected an error while streaming the data. The DRDA protocol, or at least Derby's implementation of it, doesn't enable the client to inform the server about the error whilst streaming (there is a mechanism in DRDA to interrupt a running request, but it didn't seem like a feasible approach in this case).
Modifier and Type | Field and Description |
---|---|
protected boolean |
isLayerBStream
Whether or not the subclass is a layer B stream.
|
protected boolean |
readStatusByte
Whether or not to read the trailing Derby-specific status byte.
|
private byte |
status
The status Derby-specific status byte, if any.
|
private boolean |
statusSet
Tells if the status byte has been set.
|
private boolean |
suppressException
Whether or not to suppress the exception when an error is indicated by
the status byte.
|
Modifier | Constructor and Description |
---|---|
protected |
EXTDTAReaderInputStream(boolean layerB,
boolean readStatusByte)
Initializes the class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkStatus(int clientStatus)
Interprets the Derby-specific status byte, and throws an exception if an
error condition has been detected on the client.
|
byte |
getStatus()
Returns the status byte.
|
boolean |
isLayerBStream() |
boolean |
isStatusSet()
Returns whether the status has been set or not.
|
protected abstract void |
onClientSideStreamingError()
Performs necessary clean up when an error is signalled by the client.
|
private void |
setStatus(int status)
Saves the status byte read off the wire.
|
(package private) void |
setSuppressException(boolean flag)
Sets whether or not to suppress the exception when setting the status.
|
(package private) static void |
throwEXTDTATransferException(int status)
Throws an exception as mandated by the EXTDTA status byte.
|
protected final boolean isLayerBStream
protected final boolean readStatusByte
private boolean statusSet
checkStatus(int)
private byte status
isStatusSet()
private boolean suppressException
protected EXTDTAReaderInputStream(boolean layerB, boolean readStatusByte)
layerB
- whether or not DDM layer B streaming is being usedreadStatusByte
- whether or not to read the trailing Derby-specific
status byteprivate void setStatus(int status)
status
- the statusDRDAConstants
public boolean isStatusSet()
true
if set, false
if not.public byte getStatus()
NOTE: Check if the status byte has been set by calling isStatusSet().
void setSuppressException(boolean flag)
flag
- true
to suppress, false
to throw exception
if an error condition is indicated by the status flagpublic boolean isLayerBStream()
protected void checkStatus(int clientStatus) throws java.io.IOException
clientStatus
- the status flag sent by the clientjava.io.IOException
- if the status byte indicates an error conditionprotected abstract void onClientSideStreamingError()
static void throwEXTDTATransferException(int status) throws java.io.IOException
status
- the EXTDTA status byte received from the client, should
not be DRDAConstants.STREAM_OKjava.io.IOException
- the exception generated based on the status byteApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.