public class JPIPMessageDecoder
extends java.lang.Object
readMessage()
method is
called, only one JPIP message is read. And the method who is calling must be
taken into account when a JPIP End Of Response message is received, then it
must not call the readMessage()
method. If it call
after the JPIP End Of Response message is received, a IOException
will be thrown.
This class needs a input stram where data are readed from. This class
only needs a read
method to read a byte
value and
a readFully
method to read a byte array.
Usage example:
construct
setParameters
readMessage
....
readMessage
Modifier and Type | Field and Description |
---|---|
private long |
headerLength
Indicates the length of the JPIP message header.
|
(package private) JPIPMessageReader |
inputStreamReader
It is the input stream where data are read from.
|
private int |
lastClass
Contains the last Class value.
|
private int |
lastCSn
Contains the last CSn value.
|
Constructor and Description |
---|
JPIPMessageDecoder()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
list(java.io.PrintStream out)
Prints this JPIP Message Decoder fields out to the specified output
stream.
|
private JPIPMessage |
readEORMessage()
Reads the End Of Response message.
|
JPIPMessage |
readMessage()
This method is used to read a JPIP messase.
|
private long |
readVBAS()
Reads a Variable-length Byte-Aligned Segment.
|
void |
setParameters(JPIPMessageReader inputStreamReader)
Sets the input stream where the data are read from.
|
java.lang.String |
toString() |
JPIPMessageReader inputStreamReader
private int lastClass
private int lastCSn
private long headerLength
public void setParameters(JPIPMessageReader inputStreamReader)
inputStreamReader
- definition in inputStreamReader
public JPIPMessage readMessage() throws java.net.ProtocolException, java.io.IOException
JPIPMessage
object is built.JPIPMessage
object.java.net.ProtocolException
- if received data can not be decoded correctly.java.io.IOException
- if data can not be read from the input stream. It may
be because the link is broken, the server closed the connection, ...public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.private long readVBAS() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.private JPIPMessage readEORMessage() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)