public StreamReader(String stream) { this.name = "'string'"; this.buffer = ""; // to set length to 0 checkPrintable(stream); this.buffer = stream + "\0"; this.stream = null; this.eof = true; this.data = null; }
public StreamReader(String stream) { this.name = "'string'"; this.buffer = ""; // to set length to 0 checkPrintable(stream); this.buffer = stream + "\0"; this.stream = null; this.eof = true; this.data = null; }
private void update() { if (!this.eof) { this.buffer = buffer.substring(this.pointer); this.pointer = 0; try { int converted = this.stream.read(data); if (converted > 0) { /* * Let's create StringBuilder manually. Anyway str1 + str2 * generates new StringBuilder(str1).append(str2).toSting() * Giving correct capacity to the constructor prevents * unnecessary operations in appends. */ checkPrintable(data, 0, converted); this.buffer = new StringBuilder(buffer.length() + converted).append(buffer) .append(data, 0, converted).toString(); } else { this.eof = true; this.buffer += "\0"; } } catch (IOException ioe) { throw new YAMLException(ioe); } } }
checkPrintable(this.buffer); } else { this.eof = true;