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