Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/JBuffer.java @ 1054:87275900646e
remove JBuffer.toString()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Nov 2016 01:03:02 -0700 |
parents | 7e4b41247544 |
children | 013939bfc9e8 |
comparison
equal
deleted
inserted
replaced
1053:7e4b41247544 | 1054:87275900646e |
---|---|
57 return bb.hasRemaining(); | 57 return bb.hasRemaining(); |
58 } | 58 } |
59 | 59 |
60 public byte get() { | 60 public byte get() { |
61 return bb.get(); | 61 return bb.get(); |
62 } | |
63 | |
64 public void get(byte[] bytes) { | |
65 bb.get(bytes); | |
62 } | 66 } |
63 | 67 |
64 public void compact() { | 68 public void compact() { |
65 int n = bb.remaining(); | 69 int n = bb.remaining(); |
66 bb.compact(); | 70 bb.compact(); |
171 bb.duplicate().get(bytes); | 175 bb.duplicate().get(bytes); |
172 return bytes; | 176 return bytes; |
173 } | 177 } |
174 | 178 |
175 @Override | 179 @Override |
176 public String toString() | 180 public String toString() { |
177 { | 181 // return toString("ISO-8859-1"); |
178 return toString("ISO-8859-1"); | 182 // Thread.dumpStack(); |
179 } | 183 throw new RuntimeException("toString"); |
180 | |
181 public final String toString(int index, int length) { | |
182 ByteBuffer dup = bb.duplicate(); | |
183 dup.limit(index+length); | |
184 dup.position(index); | |
185 return new JBuffer(dup).toString(); | |
186 } | |
187 | |
188 private final String toString(String charset) | |
189 { | |
190 byte[] bytes = asArray(); | |
191 try | |
192 { | |
193 return new String(bytes,charset); | |
194 } | |
195 catch(Exception e) | |
196 { | |
197 LOG.warn("",e); | |
198 return new String(bytes); | |
199 } | |
200 } | 184 } |
201 | 185 |
202 | 186 |
203 private JBuffer pokeBuffer(int index) { | 187 private JBuffer pokeBuffer(int index) { |
204 JBuffer dup = duplicate(); | 188 JBuffer dup = duplicate(); |