Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/BufferUtil.java @ 1054:87275900646e
remove JBuffer.toString()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Nov 2016 01:03:02 -0700 |
parents | 4a2489f1d5fe |
children | e6ca3cb52837 |
comparison
equal
deleted
inserted
replaced
1053:7e4b41247544 | 1054:87275900646e |
---|---|
17 // | 17 // |
18 | 18 |
19 package org.eclipse.jetty.io; | 19 package org.eclipse.jetty.io; |
20 | 20 |
21 import java.nio.ByteBuffer; | 21 import java.nio.ByteBuffer; |
22 import java.nio.charset.Charset; | |
22 import org.eclipse.jetty.util.StringUtil; | 23 import org.eclipse.jetty.util.StringUtil; |
23 | 24 |
24 | 25 |
25 /* ------------------------------------------------------------------------------- */ | 26 /* ------------------------------------------------------------------------------- */ |
26 /** Buffer utility methods. | 27 /** Buffer utility methods. |
303 ByteBuffer bb = ByteBuffer.allocateDirect(size); | 304 ByteBuffer bb = ByteBuffer.allocateDirect(size); |
304 bb.limit(0); | 305 bb.limit(0); |
305 return new JBuffer(bb); | 306 return new JBuffer(bb); |
306 } | 307 } |
307 | 308 |
309 | |
310 | |
311 private static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); | |
312 | |
313 public static String getString(JBuffer buffer) { | |
314 byte[] bytes = new byte[buffer.remaining()]; | |
315 buffer.get(bytes); | |
316 return new String(bytes,ISO_8859_1); | |
317 } | |
308 } | 318 } |