1 package be
.nikiroo
.fanfix
.supported
;
4 import java
.io
.IOException
;
5 import java
.net
.MalformedURLException
;
6 import java
.net
.URISyntaxException
;
10 * Support class for HTML files created with this program (as we need some
11 * metadata available in those we create).
15 class Html
extends InfoText
{
17 public String
getSourceName() {
22 protected boolean supports(URL url
) {
23 if (url
.getPath().toLowerCase()
24 .endsWith(File
.separatorChar
+ "index.html")) {
26 File file
= new File(url
.toURI()).getParentFile();
27 return super.supports(file
.toURI().toURL());
28 } catch (URISyntaxException e
) {
29 } catch (MalformedURLException e
) {
37 public URL
getCanonicalUrl(URL source
) throws IOException
{
38 if (source
.toString().endsWith(File
.separator
+ "index.html")) {
40 File fakeFile
= new File(source
.toURI()); // "story/index.html"
41 fakeFile
= new File(fakeFile
.getParent()); // "story"
42 fakeFile
= new File(fakeFile
, fakeFile
.getName()); // "story/story"
43 return fakeFile
.toURI().toURL();
44 } catch (URISyntaxException e
) {
45 throw new IOException(
46 "file not supported (maybe not created with this program or corrupt)",