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