1 | /** |
---|
2 | * XML Web generátor – program na generování webových stránek |
---|
3 | * Copyright © 2012 František Kučera (frantovo.cz) |
---|
4 | * |
---|
5 | * This program is free software: you can redistribute it and/or modify |
---|
6 | * it under the terms of the GNU General Public License as published by |
---|
7 | * the Free Software Foundation, version 3 of the License. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | */ |
---|
17 | package cz.frantovo.xmlWebGenerator; |
---|
18 | |
---|
19 | import java.io.File; |
---|
20 | import java.net.URI; |
---|
21 | import java.net.URISyntaxException; |
---|
22 | import java.util.Date; |
---|
23 | |
---|
24 | /** |
---|
25 | * Společná knihovna funkcí volaných z XSLT |
---|
26 | * |
---|
27 | * @author František Kučera (frantovo.cz) |
---|
28 | */ |
---|
29 | public class Funkce { |
---|
30 | |
---|
31 | /** |
---|
32 | * Zjištuje, kdy byl naposledy daný soubor změněn. |
---|
33 | * |
---|
34 | * @param soubor cesta k souboru |
---|
35 | * @return datum poslední změny |
---|
36 | * @throws URISyntaxException |
---|
37 | */ |
---|
38 | public static Date posledníZměna(String soubor) throws URISyntaxException { |
---|
39 | URI uri = new URI(soubor); |
---|
40 | File f = new File(uri); |
---|
41 | return new Date(f.lastModified()); |
---|
42 | } |
---|
43 | |
---|
44 | public static String spojText(String[] kusyTextu) { |
---|
45 | if (kusyTextu == null || kusyTextu.length < 1) { |
---|
46 | return null; |
---|
47 | } else { |
---|
48 | StringBuilder sb = new StringBuilder(); |
---|
49 | for (int i = 0; i < kusyTextu.length; i++) { |
---|
50 | sb.append(kusyTextu[i]); |
---|
51 | } |
---|
52 | return sb.toString(); |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|