/** * Build an array of JavaScript string literals that can be decoded by the * client via the eval function. * * NOTE: We build the array in reverse so the client can simply use the pop * function to remove the next item from the list. */ @Override public String toString() { // Build a JavaScript string (with escaping, of course). // We take a guess at how big to make to buffer to avoid numerous resizes. // int capacityGuess = 2 * tokenListCharCount + 2 * tokenList.size(); LengthConstrainedArray stream = new LengthConstrainedArray(capacityGuess); writePayload(stream); writeStringTable(stream); writeHeader(stream); return stream.toString(); }
/** * Build an array of JavaScript string literals that can be decoded by the * client via the eval function. * * NOTE: We build the array in reverse so the client can simply use the pop * function to remove the next item from the list. */ @Override public String toString() { // Build a JavaScript string (with escaping, of course). // We take a guess at how big to make to buffer to avoid numerous resizes. // int capacityGuess = 2 * tokenListCharCount + 2 * tokenList.size(); LengthConstrainedArray stream = new LengthConstrainedArray(capacityGuess); writePayload(stream); writeStringTable(stream); writeHeader(stream); return stream.toString(); }
/** * Build an array of JavaScript string literals that can be decoded by the * client via the eval function. * * NOTE: We build the array in reverse so the client can simply use the pop * function to remove the next item from the list. */ @Override public String toString() { // Build a JavaScript string (with escaping, of course). // We take a guess at how big to make to buffer to avoid numerous resizes. // int capacityGuess = 2 * tokenListCharCount + 2 * tokenList.size(); LengthConstrainedArray stream = new LengthConstrainedArray(capacityGuess); writePayload(stream); writeStringTable(stream); writeHeader(stream); return stream.toString(); }
private void writeStringTable(LengthConstrainedArray stream) { LengthConstrainedArray tableStream = new LengthConstrainedArray(); for (String s : getStringTable()) { tableStream.addEscapedToken(s); } stream.addToken(tableStream.toString()); stream.setJavaScript(stream.isJavaScript() || tableStream.isJavaScript()); } }
private void writeStringTable(LengthConstrainedArray stream) { LengthConstrainedArray tableStream = new LengthConstrainedArray(); for (String s : getStringTable()) { tableStream.addEscapedToken(s); } stream.addToken(tableStream.toString()); stream.setJavaScript(stream.isJavaScript() || tableStream.isJavaScript()); } }
private void writeStringTable(LengthConstrainedArray stream) { LengthConstrainedArray tableStream = new LengthConstrainedArray(); for (String s : getStringTable()) { tableStream.addEscapedToken(s); } stream.addToken(tableStream.toString()); stream.setJavaScript(stream.isJavaScript() || tableStream.isJavaScript()); } }