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