wt.wrmf.transport
Class FlagCheckingInputStream
java.lang.Object
java.io.InputStream
wt.wrmf.transport.FlagCheckingInputStream
- All Implemented Interfaces:
- Serializable
- public class FlagCheckingInputStream
- extends InputStream
- implements Serializable
The constructor accepts an inputstream
and one or more serializable object:
header and/or trailer.
The size of the header/trailer (headerSize/trailSize) is calculated.
It will extract the header (if any) and check it,
then reserve last trailSize bytes (if any; otherwise IOException will
be thrown)
from the input stream and tries to verify the reserved bytes that they
can be deserialized to the trailer.
The constructed InputStream is equivalent to the original InputStream
without the trailer.
Supported API: false
Extendable: false
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RESOURCE
private static final String RESOURCE
- See Also:
- Constant Field Values
CLASSNAME
private static final String CLASSNAME
trailerSize
private int trailerSize
headerSize
private int headerSize
is
private InputStream is
headerType
private String headerType
trailerType
private String trailerType
all
private SegmentedInputStream all
tempFileName
private String tempFileName
TEMP_DIR
private static String TEMP_DIR
deleteThread
private static TempFileDeletion deleteThread
FlagCheckingInputStream
public FlagCheckingInputStream(InputStream is)
throws IOException
- Default constructor: no header and a fixed trailer.
The trailer is always a type of StreamFlag and of
57 bytes.
Supported API: false
- Parameters:
is
-
- Throws:
IOException
FlagCheckingInputStream
public FlagCheckingInputStream(InputStream is,
Serializable header,
Serializable trailer)
throws IOException
Supported API: false
- Parameters:
is
- header
- trailer
-
- Throws:
IOException
read
public int read()
throws IOException
Supported API: false
- Returns:
- int
- Throws:
IOException
extractHeader
private void extractHeader()
throws IOException
- Throws:
IOException
checkHeader
private boolean checkHeader(InputStream headerStream)
extractTrailer
private void extractTrailer()
throws IOException
- Throws:
IOException
isTrailerSuccessful
private boolean isTrailerSuccessful()
read
public int read(byte[] buf)
throws IOException
- Throws:
IOException
read
public int read(byte[] buf,
int off,
int len)
throws IOException
- Throws:
IOException
close
public void close()
throws IOException
- Throws:
IOException