1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.eclipse.jetty.io;
15
16 import java.text.DateFormatSymbols;
17 import java.util.Locale;
18
19 import org.eclipse.jetty.util.DateCache;
20
21 public class BufferDateCache extends DateCache
22 {
23 Buffer _buffer;
24 String _last;
25
26 public BufferDateCache()
27 {
28 super();
29 }
30
31 public BufferDateCache(String format, DateFormatSymbols s)
32 {
33 super(format,s);
34 }
35
36 public BufferDateCache(String format, Locale l)
37 {
38 super(format,l);
39 }
40
41 public BufferDateCache(String format)
42 {
43 super(format);
44 }
45
46 public synchronized Buffer formatBuffer(long date)
47 {
48 String d = super.format(date);
49
50 if (d==_last)
51 return _buffer;
52 _last=d;
53 _buffer=new ByteArrayBuffer(d);
54
55 return _buffer;
56 }
57 }