|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
java.io.BufferedInputStream
org.argouml.persistence.XmlInputStream
A BufferInputStream that is aware of XML structure. It can searches for the first occurence of a named tag and reads only the data (inclusively) from that tag to the matching end tag or it can search for the first occurence of a named tag and read on the child tags. The tag is not expected to be an empty tag.
Field Summary | |
private Map |
attributes
|
private byte[] |
buffer
|
private boolean |
childOnly
|
private StringBuffer |
currentTag
|
private boolean |
endStream
|
private String |
endTagName
|
private long |
eventSpacing
The number of bytes to be read between each progress event. |
private int |
instanceCount
|
private int |
instanceRequired
|
private boolean |
inTag
|
private long |
length
The expected stream length |
private EventListenerList |
listenerList
|
private static Logger |
LOG
|
private long |
readCount
The number of characters read so far |
private String |
tagName
|
private boolean |
xmlStarted
|
Fields inherited from class java.io.BufferedInputStream |
buf, count, marklimit, markpos, pos |
Fields inherited from class java.io.FilterInputStream |
in |
Fields inherited from class java.io.InputStream |
|
Constructor Summary | |
XmlInputStream(InputStream in,
String theTag,
long theLength,
long theEventSpacing)
Construct a new XmlInputStream |
Method Summary | |
void |
addProgressListener(ProgressListener listener)
|
void |
close()
The close method is overridden to prevent some class out of our control from closing the stream (such as a SAX parser). |
private void |
fireProgressEvent()
|
private boolean |
isLastTag(int ch)
Determines if the character is the last character of the last tag of interest. |
private boolean |
isNameTerminator(char ch)
|
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
private Map |
readAttributes()
Having read the inputstream up until the tag name. |
void |
realClose()
Really close the input |
private int |
realRead()
|
void |
removeProgressListener(ProgressListener listener)
|
void |
reopen(String theTag)
Reopen a stream that has already reached the end of an XML fragment. |
void |
reopen(String theTag,
Map attribs,
boolean child)
Reopen a stream that has already reached the end of an XML fragment. |
private void |
skipToTag()
Keep on reading an input stream until a specific sequence of characters has ben read. |
private int |
superRead()
|
Methods inherited from class java.io.BufferedInputStream |
available, mark, markSupported, reset, skip |
Methods inherited from class java.io.FilterInputStream |
read |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private boolean xmlStarted
private boolean inTag
private StringBuffer currentTag
private boolean endStream
private String tagName
private String endTagName
private Map attributes
private boolean childOnly
private int instanceRequired
private int instanceCount
private byte[] buffer
private EventListenerList listenerList
private long eventSpacing
private long readCount
private long length
private static final Logger LOG
Constructor Detail |
public XmlInputStream(InputStream in, String theTag, long theLength, long theEventSpacing)
in
- the input stream to wrap.theTag
- the tag name from which to start readingtheLength
- the expected length of the input streamtheEventSpacing
- the number of characers to read before
firing a progress event.Method Detail |
public void reopen(String theTag, Map attribs, boolean child)
theTag
- the tag nameattribs
- the attributeschild
- child onlypublic void reopen(String theTag)
theTag
- the tag namepublic int read() throws IOException
IOException
InputStream.read()
public int read(byte[] b, int off, int len) throws IOException
IOException
InputStream.read(byte[], int, int)
private boolean isLastTag(int ch)
ch
- the character to test.
private void skipToTag() throws IOException
IOException
private boolean isNameTerminator(char ch)
private Map readAttributes() throws IOException
IOException
public void close() throws IOException
IOException
- to satisfy ancestor but will never happen.public void realClose() throws IOException
IOException
- if an I/O error occurs.private int realRead() throws IOException
IOException
private int superRead() throws IOException
IOException
private void fireProgressEvent()
public void addProgressListener(ProgressListener listener)
listener
- the progress listenerpublic void removeProgressListener(ProgressListener listener)
listener
- the progress listener
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |