2 * Sone - SoneUri.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.core;
20 import static java.util.logging.Logger.getLogger;
22 import java.net.MalformedURLException;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
26 import freenet.keys.FreenetURI;
29 * Helper class that creates {@link FreenetURI}s for Sone to insert to and
32 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
34 public class SoneUri {
37 private static final Logger logger = getLogger("Sone.Data");
40 * Generate a Sone URI from the given URI.
43 * The URI to derive the Sone URI from
44 * @return The derived URI
46 public static FreenetURI create(String uri) {
48 return new FreenetURI(uri).setDocName("Sone").setMetaString(new String[0]);
49 } catch (MalformedURLException mue1) {
50 /* this should never happen. */
51 logger.log(Level.WARNING, String.format("Could not create Sone URI from URI: %s", uri), mue1);