comparison src/org/eclipse/jetty/io/BufferUtil.java @ 1074:6b7ff30bb990

rename putQ() to put()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 10 Nov 2016 02:37:15 -0700
parents 9d357b9e4bcb
children ebb0f1343ef6
comparison
equal deleted inserted replaced
1073:6e511ea557b4 1074:6b7ff30bb990
73 public static void putHexInt(JBuffer buffer, int n) 73 public static void putHexInt(JBuffer buffer, int n)
74 { 74 {
75 75
76 if (n < 0) 76 if (n < 0)
77 { 77 {
78 buffer.putQ((byte)'-'); 78 buffer.put((byte)'-');
79 79
80 if (n == Integer.MIN_VALUE) 80 if (n == Integer.MIN_VALUE)
81 { 81 {
82 buffer.putQ((byte)(0x7f&'8')); 82 buffer.put((byte)(0x7f&'8'));
83 buffer.putQ((byte)(0x7f&'0')); 83 buffer.put((byte)(0x7f&'0'));
84 buffer.putQ((byte)(0x7f&'0')); 84 buffer.put((byte)(0x7f&'0'));
85 buffer.putQ((byte)(0x7f&'0')); 85 buffer.put((byte)(0x7f&'0'));
86 buffer.putQ((byte)(0x7f&'0')); 86 buffer.put((byte)(0x7f&'0'));
87 buffer.putQ((byte)(0x7f&'0')); 87 buffer.put((byte)(0x7f&'0'));
88 buffer.putQ((byte)(0x7f&'0')); 88 buffer.put((byte)(0x7f&'0'));
89 buffer.putQ((byte)(0x7f&'0')); 89 buffer.put((byte)(0x7f&'0'));
90 90
91 return; 91 return;
92 } 92 }
93 n= -n; 93 n= -n;
94 } 94 }
95 95
96 if (n < 0x10) 96 if (n < 0x10)
97 { 97 {
98 buffer.putQ(DIGIT[n]); 98 buffer.put(DIGIT[n]);
99 } 99 }
100 else 100 else
101 { 101 {
102 boolean started= false; 102 boolean started= false;
103 // This assumes constant time int arithmatic 103 // This assumes constant time int arithmatic
104 for (int i= 0; i < hexDivisors.length; i++) 104 for (int i= 0; i < hexDivisors.length; i++)
105 { 105 {
106 if (n < hexDivisors[i]) 106 if (n < hexDivisors[i])
107 { 107 {
108 if (started) 108 if (started)
109 buffer.putQ((byte)'0'); 109 buffer.put((byte)'0');
110 continue; 110 continue;
111 } 111 }
112 112
113 started= true; 113 started= true;
114 int d = n / hexDivisors[i]; 114 int d = n / hexDivisors[i];
115 buffer.putQ(DIGIT[d]); 115 buffer.put(DIGIT[d]);
116 n= n - d * hexDivisors[i]; 116 n= n - d * hexDivisors[i];
117 } 117 }
118 } 118 }
119 } 119 }
120 120
121 public static void putDecLong(JBuffer buffer, long n) 121 public static void putDecLong(JBuffer buffer, long n)
122 { 122 {
123 if (n < 0) 123 if (n < 0)
124 { 124 {
125 buffer.putQ((byte)'-'); 125 buffer.put((byte)'-');
126 126
127 if (n == Long.MIN_VALUE) 127 if (n == Long.MIN_VALUE)
128 { 128 {
129 buffer.putQ((byte)'9'); 129 buffer.put((byte)'9');
130 n = 223372036854775808L; 130 n = 223372036854775808L;
131 } 131 }
132 else 132 else
133 n = -n; 133 n = -n;
134 } 134 }
135 135
136 if (n < 10) 136 if (n < 10)
137 { 137 {
138 buffer.putQ(DIGIT[(int)n]); 138 buffer.put(DIGIT[(int)n]);
139 } 139 }
140 else 140 else
141 { 141 {
142 boolean started= false; 142 boolean started= false;
143 // This assumes constant time int arithmatic 143 // This assumes constant time int arithmatic
144 for (int i= 0; i < decDivisorsL.length; i++) 144 for (int i= 0; i < decDivisorsL.length; i++)
145 { 145 {
146 if (n < decDivisorsL[i]) 146 if (n < decDivisorsL[i])
147 { 147 {
148 if (started) 148 if (started)
149 buffer.putQ((byte)'0'); 149 buffer.put((byte)'0');
150 continue; 150 continue;
151 } 151 }
152 152
153 started= true; 153 started= true;
154 long d= n / decDivisorsL[i]; 154 long d= n / decDivisorsL[i];
155 buffer.putQ(DIGIT[(int)d]); 155 buffer.put(DIGIT[(int)d]);
156 n= n - d * decDivisorsL[i]; 156 n= n - d * decDivisorsL[i];
157 } 157 }
158 } 158 }
159 } 159 }
160 160