Refine search
@Override public String asText() { return NumberOutput.toString(_value); }
return outputInt((int) v, b, off); return _outputSmallestL(b, off); } else { if (v <= MAX_INT_AS_LONG) { return outputInt((int) v, b, off); off = _outputUptoBillion((int) upper, b, off); } else { off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off); return _outputFullBillion((int) v, b, off);
@Override public void writeNumber(long l) throws IOException { _verifyValueWrite(WRITE_NUMBER); if (_cfgNumbersAsStrings) { _writeQuotedLong(l); return; } if ((_outputTail + 21) >= _outputEnd) { // up to 20 digits, minus sign _flushBuffer(); } _outputTail = NumberOutput.outputLong(l, _outputBuffer, _outputTail); }
private static int _outputUptoBillion(int v, char[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); enc = TRIPLET_TO_CHARS[ones]; b[off++] = (char) (enc >> 16); b[off++] = (char) ((enc >> 8) & 0x7F); b[off++] = (char) (enc & 0x7F); return off; }
return _outputSmallestI(b, off); b[off++] = (byte) ('0' + v); } else { off = _leading3(v, b, off); off = _leading3(thousands, b, off); off = _full3(v, b, off); b[off++] = '1'; return _outputFullBillion(v, b, off); newValue /= 1000; int thousands = (v - (newValue * 1000)); off = _leading3(newValue, b, off); off = _full3(thousands, b, off); return _full3(ones, b, off);
private final void _writeQuotedInt(int i) throws IOException { if ((_outputTail + 13) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputInt(i, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
private final void _writeQuotedLong(long l) throws IOException { if ((_outputTail + 23) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputLong(l, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
@Override public void writeNumber(int i) throws IOException { _verifyValueWrite(WRITE_NUMBER); // up to 10 digits and possible minus sign if ((_outputTail + 11) >= _outputEnd) { _flushBuffer(); } if (_cfgNumbersAsStrings) { _writeQuotedInt(i); return; } _outputTail = NumberOutput.outputInt(i, _outputBuffer, _outputTail); }
@Override public void writeNumber(short s) throws IOException { _verifyValueWrite(WRITE_NUMBER); // up to 5 digits and possible minus sign if ((_outputTail + 6) >= _outputEnd) { _flushBuffer(); } if (_cfgNumbersAsStrings) { _writeQuotedShort(s); return; } _outputTail = NumberOutput.outputInt(s, _outputBuffer, _outputTail); }
private void _writeQuotedLong(long l) throws IOException { if ((_outputTail + 23) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputLong(l, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
private void _writeQuotedShort(short s) throws IOException { if ((_outputTail + 8) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputInt(s, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
private final void _writeQuotedShort(short s) throws IOException { if ((_outputTail + 8) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputInt(s, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
return _outputSmallestI(b, off); return off+1; return _leading3(v, b, off); off = _leading3(thousands, b, off); off = _full3(v, b, off); return off; b[off++] = '1'; return _outputFullBillion(v, b, off); int thousands = (v - (newValue * 1000)); off = _leading3(newValue, b, off); off = _full3(thousands, b, off); return _full3(ones, b, off);
private final void _writeQuotedLong(long l) throws IOException { if ((_outputTail + 23) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputLong(l, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
@Override public void writeNumber(int i) throws IOException { _verifyValueWrite(WRITE_NUMBER); // up to 10 digits and possible minus sign if ((_outputTail + 11) >= _outputEnd) { _flushBuffer(); } if (_cfgNumbersAsStrings) { _writeQuotedInt(i); return; } _outputTail = NumberOutput.outputInt(i, _outputBuffer, _outputTail); }
@Override public void writeNumber(short s) throws IOException { _verifyValueWrite(WRITE_NUMBER); // up to 5 digits and possible minus sign if ((_outputTail + 6) >= _outputEnd) { _flushBuffer(); } if (_cfgNumbersAsStrings) { _writeQuotedShort(s); return; } _outputTail = NumberOutput.outputInt(s, _outputBuffer, _outputTail); }
private void _writeQuotedLong(long l) throws IOException { if ((_outputTail + 23) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputLong(l, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
private void _writeQuotedInt(int i) throws IOException { if ((_outputTail + 13) >= _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = _quoteChar; _outputTail = NumberOutput.outputInt(i, _outputBuffer, _outputTail); _outputBuffer[_outputTail++] = _quoteChar; }
private static int _outputUptoBillion(int v, byte[] b, int off) { if (v < MILLION) { // at most 2 triplets... if (v < 1000) { return _leading3(v, b, off); } int thousands = v / 1000; int ones = v - (thousands * 1000); // == value % 1000 return _outputUptoMillion(b, off, thousands, ones); } int thousands = v / 1000; int ones = (v - (thousands * 1000)); // == value % 1000 int millions = thousands / 1000; thousands -= (millions * 1000); off = _leading3(millions, b, off); int enc = TRIPLET_TO_CHARS[thousands]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; enc = TRIPLET_TO_CHARS[ones]; b[off++] = (byte) (enc >> 16); b[off++] = (byte) (enc >> 8); b[off++] = (byte) enc; return off; }
return outputInt((int) v, b, off); return _outputSmallestL(b, off); } else { if (v <= MAX_INT_AS_LONG) { return outputInt((int) v, b, off); off = _outputUptoBillion((int) upper, b, off); } else { off = _leading3((int) hi, b, off); off = _outputFullBillion((int) upper, b, off); return _outputFullBillion((int) v, b, off);