本文整理匯總了Java中java.io.StringReader.reset方法的典型用法代碼示例。如果您正苦於以下問題:Java StringReader.reset方法的具體用法?Java StringReader.reset怎麽用?Java StringReader.reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.io.StringReader
的用法示例。
在下文中一共展示了StringReader.reset方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: skipLws
import java.io.StringReader; //導入方法依賴的package包/類
private static int skipLws(StringReader input, boolean withReset)
throws IOException {
if (withReset) {
input.mark(1);
}
int c = input.read();
while (c == 32 || c == 9 || c == 10 || c == 13) {
if (withReset) {
input.mark(1);
}
c = input.read();
}
if (withReset) {
input.reset();
}
return c;
}
示例2: getTag
import java.io.StringReader; //導入方法依賴的package包/類
private String getTag(StringReader reader) throws IOException, TextParseException {
StringBuilder builder = new StringBuilder();
int c;
reader.mark(1);
while ((c = reader.read()) != '>' && !Character.isWhitespace(c)) {
if (c <= 0) {
throw new TextParseException("Unterminated tag");
}
reader.mark(1);
builder.append((char) c);
}
reader.reset();
return builder.toString();
}
示例3: skipLws
import java.io.StringReader; //導入方法依賴的package包/類
private static int skipLws(StringReader input, boolean withReset) throws IOException {
if (withReset) {
input.mark(1);
}
int c = input.read();
while (c == 32 || c == 9 || c == 10 || c == 13) {
if (withReset) {
input.mark(1);
}
c = input.read();
}
if (withReset) {
input.reset();
}
return c;
}
示例4: readString
import java.io.StringReader; //導入方法依賴的package包/類
public static String readString(StringReader rd) throws Exception {
// if there is an error in encoding, let the base functions throw an exception
CSList<Character> clist = new CSList<Character>();
int nextchar = -1;
boolean stop = false;
while (!stop)
{
if ((nextchar = rd.read()) == -1)
stop = true;
else if ((char)nextchar != '|')
clist.add((char)nextchar);
else
{
// ignore first | and check whether there is another | following
// if the next one is | again, then
rd.mark(1);
if (((nextchar = rd.read()) != -1) && ((char)nextchar == '|'))
{
// this was an escaped |, and so read it as such
clist.add((char)nextchar);
}
else
{
rd.reset(); //return the stolen character
stop = true;
}
}
}
return clist.toArray().toString();
}