Last change
on this file since 14627 was 14627, checked in by oranfry, 17 years ago |
initial import of the gs3-release-maker
|
File size:
840 bytes
|
Line | |
---|
1 | package ise.antelope.tasks.typedefs.file;
|
---|
2 |
|
---|
3 | import java.io.*;
|
---|
4 | import java.text.SimpleDateFormat;
|
---|
5 | import java.util.Date;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Copyright 2003
|
---|
9 | *
|
---|
10 | * @version $Revision: 1.1 $
|
---|
11 | */
|
---|
12 | public class LastModified implements FileOp {
|
---|
13 |
|
---|
14 | private String format = null;
|
---|
15 |
|
---|
16 | public void setFormat(String f) {
|
---|
17 | format = f;
|
---|
18 | }
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Checks if the given file is writable
|
---|
22 | *
|
---|
23 | * @param f a file
|
---|
24 | * @return true if the file is a writable.
|
---|
25 | */
|
---|
26 | public String execute(File f) {
|
---|
27 | if (f == null)
|
---|
28 | throw new IllegalArgumentException("file cannot be null");
|
---|
29 | Date date = new Date(f.lastModified());
|
---|
30 | String lm;
|
---|
31 | if (format != null)
|
---|
32 | lm = new SimpleDateFormat(format).format(date);
|
---|
33 | else
|
---|
34 | lm = date.toString();
|
---|
35 | return lm;
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.