Skip to content

Commit 2f2f358

Browse files
jirka.pinkas@gmail.comjirka.pinkas@gmail.com
authored andcommitted
*Generator::toFile(String first, String ... more), *Generator::toFile(File parent, String child) methods
1 parent e96fa9e commit 2f2f358

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractSitemapGenerator.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.net.*;
99
import java.nio.charset.StandardCharsets;
1010
import java.nio.file.Path;
11+
import java.nio.file.Paths;
1112
import java.sql.Timestamp;
1213
import java.time.LocalDateTime;
1314
import java.util.Date;
@@ -177,6 +178,30 @@ public T toFile(Path path) throws IOException {
177178
return toFile(path.toFile());
178179
}
179180

181+
/**
182+
* Construct and save sitemap to output file
183+
*
184+
* @param first The path string or initial part of the path string
185+
* @param more Additional strings to be joined to form the path string
186+
* @return this
187+
* @throws IOException when error
188+
*/
189+
public T toFile(String first, String ... more) throws IOException {
190+
return toFile(Paths.get(first, more));
191+
}
192+
193+
/**
194+
* Construct and save sitemap to output file
195+
*
196+
* @param parent The parent abstract pathname
197+
* @param child The child pathname string
198+
* @return this
199+
* @throws IOException when error
200+
*/
201+
public T toFile(File parent, String child) throws IOException {
202+
return toFile(new File(parent, child));
203+
}
204+
180205
/**
181206
* Ping Google that sitemap has changed. Will call this URL:
182207
* https://www.google.com/ping?sitemap=URL_Encoded_sitemapUrl

0 commit comments

Comments
 (0)