public static void putNumAsText(Writable out, long n) { if (n >= 0) { writeDigits(out, n); } else { if (n == Long.MIN_VALUE) { writeAscii(out, MIN_VALUE); } else { out.writeByte((byte) '-'); putNumAsText(out, -n); } } }
private static void writeDigits(Writable out, long n) { int digit = (int) (n % 10); if (n >= 10) { writeDigits(out, n / 10); } out.writeByte((byte) (digit + '0')); }
@Override public void writeByte(byte byteValue) { requireCapacity(count + 1); bytes[count] = byteValue; count++; }
@Override public void render(OutputStream out) { String html = render(); WritableUtils.writeUTF8(new WritableOutputStream(out), html); }
@Override public void printUTF8(String s) { WritableUtils.writeUTF8(out, s); }
public ReusableWritable pageRenderingStream() { pageRenderingStream.reset(); return pageRenderingStream; }
@Override public void renderTo(OutputStream output, Object model) { renderTo(new WritableOutputStream(output), model); }
@Override public synchronized void write(int b) { chunk.write(b); }
@Override public void printAscii(String s) { WritableUtils.writeAscii(out, s); }
@Override public void writeBytes(byte[] src) { writeBytes(src, 0, src.length); }
@Override public void write(int src) { writeByte((byte) src); }
public static void writeAscii(Writable out, byte[] bytes) { out.writeBytes(bytes); }
public ReusableWritable jsonRenderingStream() { jsonRenderingStream.reset(); return jsonRenderingStream; }
@Override public synchronized void write(byte[] b) { chunk.write(b); }
@Override public void printAscii(byte[] bytes) { WritableUtils.writeAscii(out, bytes); }
@Override public void write(byte[] src, int off, int len) { writeBytes(src, off, len); }
public ReusableWritable templateRenderingOutput() { templateRenderingOutput.reset(); return templateRenderingOutput; }
@Override public synchronized void write(byte[] b, int off, int len) { chunk.write(b, off, len); }
@Override public void write(byte[] src) { writeBytes(src); }