Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/BufferUtil.java @ 1021:e350c11242be
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 31 Oct 2016 22:49:25 -0600 |
parents | 6be43ef1eb96 |
children | a8c92b0a08ed |
comparison
equal
deleted
inserted
replaced
1020:6be43ef1eb96 | 1021:e350c11242be |
---|---|
16 // ======================================================================== | 16 // ======================================================================== |
17 // | 17 // |
18 | 18 |
19 package org.eclipse.jetty.io; | 19 package org.eclipse.jetty.io; |
20 | 20 |
21 import org.eclipse.jetty.io.BufferCache.CachedBuffer; | |
22 import org.eclipse.jetty.util.StringUtil; | |
23 | 21 |
24 /* ------------------------------------------------------------------------------- */ | 22 /* ------------------------------------------------------------------------------- */ |
25 /** Buffer utility methods. | 23 /** Buffer utility methods. |
26 * | 24 * |
27 * | 25 * |
272 public static void putCRLF(Buffer buffer) | 270 public static void putCRLF(Buffer buffer) |
273 { | 271 { |
274 buffer.put((byte)13); | 272 buffer.put((byte)13); |
275 buffer.put((byte)10); | 273 buffer.put((byte)10); |
276 } | 274 } |
277 /* | 275 |
278 public static boolean isPrefix(Buffer prefix,Buffer buffer) | |
279 { | |
280 if (prefix.length()>buffer.length()) | |
281 return false; | |
282 int bi=buffer.getIndex(); | |
283 for (int i=prefix.getIndex(); i<prefix.putIndex();i++) | |
284 if (prefix.peek(i)!=buffer.peek(bi++)) | |
285 return false; | |
286 return true; | |
287 } | |
288 */ | |
289 public static String to8859_1_String(Buffer buffer) | |
290 { | |
291 if (buffer instanceof CachedBuffer) | |
292 return buffer.toString(); | |
293 return buffer.toString(StringUtil.__ISO_8859_1_CHARSET); | |
294 } | |
295 } | 276 } |