blob: a7de46017925f31fa4111006f37d17f0ef8f6652 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package scruf.parsers;
import java.text.*;
import java.util.*;
/**
* This class produces a string of the current date. This 'current
* date' string is used append at end of the html page page.
*/
class LastUpdate implements Parser {
private String startBlock, endBlock;
private DateFormat date;
private StringBuilder sbuilder;
public LastUpdate() {
sbuilder = new StringBuilder();
startBlock = "\n<div class=\"lastupdate\">\n Last Updated on: ";
date = DateFormat.getDateInstance(DateFormat.LONG);
endBlock = "</div>\n";
}
public String parse(String fileContent) {
sbuilder.delete(0,sbuilder.length());
sbuilder.append(fileContent);
sbuilder.append(startBlock);
// date.format() returns the date at this instance in time.
sbuilder.append(date.format(new Date()));
sbuilder.append(endBlock);
return sbuilder.toString();
}
}
|