Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/BufferUtil.java @ 1059:013939bfc9e8
remove JBuffer.poke()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Nov 2016 05:39:33 -0700 |
parents | 7d872cc72ec2 |
children | 158d1e6ac17f |
comparison
equal
deleted
inserted
replaced
1058:419bf9c03d84 | 1059:013939bfc9e8 |
---|---|
115 buffer.put(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 | |
121 /* ------------------------------------------------------------ */ | |
122 /** | |
123 * Add hex integer BEFORE current getIndex. | |
124 * @param buffer | |
125 * @param n | |
126 */ | |
127 public static void prependHexInt(JBuffer buffer, int n) | |
128 { | |
129 if (n==0) | |
130 { | |
131 int gi=buffer.getIndex(); | |
132 buffer.poke(--gi,(byte)'0'); | |
133 buffer.setGetIndex(gi); | |
134 } | |
135 else | |
136 { | |
137 boolean minus=false; | |
138 if (n<0) | |
139 { | |
140 minus=true; | |
141 n=-n; | |
142 } | |
143 | |
144 int gi=buffer.getIndex(); | |
145 while(n>0) | |
146 { | |
147 int d = 0xf&n; | |
148 n=n>>4; | |
149 buffer.poke(--gi,DIGIT[d]); | |
150 } | |
151 | |
152 if (minus) | |
153 buffer.poke(--gi,(byte)'-'); | |
154 buffer.setGetIndex(gi); | |
155 } | |
156 } | |
157 | |
158 | 120 |
159 public static void putDecLong(JBuffer buffer, long n) | 121 public static void putDecLong(JBuffer buffer, long n) |
160 { | 122 { |
161 if (n < 0) | 123 if (n < 0) |
162 { | 124 { |