|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Reader
edu.upc.dama.dex.core.TextStream.TextReader
public static class TextStream.TextReader
Reader implementation for TextStream.
This way we can use TextStream as a common Java Writer:
long oid = ... // object OID
long text = ... // TEXT attribute id
dbg.getAttribute(oid, text, v);
TextStream tstrm = v.getTextStream();
StringBuffer sb = new StringBuffer();
char[] buff = new char[200];
int len = 0;
BufferedReader br = new BufferedReader(new TextReader(tstrm));
while ((len = br.read(buff, 0, 200)) != -1) {
sb.append(buff, 0, len);
}
br.close(); // it already closes underlaying Reader and TextStream
| Field Summary |
|---|
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
TextStream.TextReader(TextStream strm)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
close()
Close the stream. |
boolean |
markSupported()
Tell whether this stream supports the mark() operation. |
int |
read(char[] chars,
int i,
int i1)
Read characters into a portion of an array. |
| Methods inherited from class java.io.Reader |
|---|
mark, read, read, read, ready, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextStream.TextReader(TextStream strm)
strm - Underlaying reader TextStream.
java.lang.IllegalArgumentException - If the given TextStream is not
a reader stream.| Method Detail |
|---|
public boolean markSupported()
markSupported in class java.io.Reader
public int read(char[] chars,
int i,
int i1)
throws java.io.IOException
read in class java.io.Readerchars - Destination buffer.i - Offset at which to start storing charactersi1 - Maximum number of characters to read
java.io.IOException
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.Readerjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||