MCPcopy Index your code
hub / github.com/apache/tomcat / setLong

Method setLong

java/org/apache/tomcat/util/buf/MessageBytes.java:626–663  ·  view source on GitHub ↗

Set the buffer to the representation of a long. @param l The long

(long l)

Source from the content-addressed store, hash-verified

624 * @param l The long
625 */
626 public void setLong(long l) {
627 byteC.allocate(32, 64);
628 long current = l;
629 byte[] buf = byteC.getBuffer();
630 int start = 0;
631 int end = 0;
632 if (l == 0) {
633 buf[end++] = (byte) '0';
634 }
635 if (l < 0) {
636 buf[end++] = (byte) '-';
637 } else {
638 current = -l;
639 }
640 while (current < 0) {
641 int digit = (int) (current % 10);
642 current = current / 10;
643 buf[end++] = HexUtils.getHex(-digit);
644 }
645 byteC.setStart(0);
646 byteC.setEnd(end);
647 // Inverting buffer
648 end--;
649 if (l < 0) {
650 start++;
651 }
652 while (end > start) {
653 byte temp = buf[start];
654 buf[start] = buf[end];
655 buf[end] = temp;
656 start++;
657 end--;
658 }
659 longValue = l;
660 hasHashCode = false;
661 hasLongValue = true;
662 type = T_BYTES;
663 }
664
665 /**
666 * Convert the buffer to a long, cache the value. Used for headers conversion.

Callers 10

doTestSetLongMethod · 0.95
testNotFoundMethod · 0.45
buildPostRequestMethod · 0.45
doTest1kPayloadMethod · 0.45
prepareResponseMethod · 0.45
prepareHeadersMethod · 0.45
prepareResponseMethod · 0.45
logMethod · 0.45
keysMethod · 0.45
saveMethod · 0.45

Calls 5

getHexMethod · 0.95
setStartMethod · 0.80
setEndMethod · 0.80
allocateMethod · 0.65
getBufferMethod · 0.65

Tested by 4

doTestSetLongMethod · 0.76
testNotFoundMethod · 0.36
buildPostRequestMethod · 0.36
doTest1kPayloadMethod · 0.36