Methods Summary |
---|
public java.lang.String | getLine(java.io.ByteArrayInputStream bin)
ByteArrayOutputStream bout = new ByteArrayOutputStream();
if (bin.available() > 0) {
int ch = readChar(bin);
while (ch != '\n" && ch != '\r" && ch != -1) {
bout.write(ch);
ch = readChar(bin);
}
}
String line = new String(bout.toByteArray());
return line;
|
public boolean | getToken(java.io.ByteArrayInputStream bin, java.lang.String tokenString)
boolean found = false;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
skipWhitespace(bin);
if (bin.available() > 0) {
int ch = readChar(bin);
while (ch != '=" && ch != '\n" && ch != '\r" && ch != -1) {
bout.write(ch);
ch = readChar(bin);
}
bout.write(ch);
}
String token = new String(bout.toByteArray());
if (tokenString.equals(token)) {
found = true;
} else {
ungetToken(token);
}
return found;
|
public boolean | getToken(java.io.ByteArrayInputStream bin, java.lang.String tokenString, boolean mandatory)
boolean found = getToken(bin, tokenString);
if (!found) {
if (mandatory) {
Log.warning("[SDP Parser] Token missing: " + tokenString);
}
}
return found;
|
public void | init()
buffer = new Vector();
|
public int | readChar(java.io.ByteArrayInputStream bin)
int ch;
if (buffer.size() > 0) {
ch = ((Integer) buffer.elementAt(0)).intValue();
buffer.removeElementAt(0);
} else {
ch = bin.read();
}
return ch;
|
private void | skipWhitespace(java.io.ByteArrayInputStream bin)
int ch = readChar(bin);
while (ch == ' " || ch == '\n" || ch == '\r") {
ch = readChar(bin);
}
buffer.insertElementAt(new Integer(ch), 0);
|
public void | ungetToken(java.lang.String tokenStr)
byte token[] = tokenStr.getBytes();
for (int i = 0; i < token.length; i++) {
buffer.insertElementAt(new Integer(token[token.length - i - 1]), 0);
}
|