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