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 java.net.MalformedURLException;
21 import java.util.logging.Level;
22 import java.util.logging.Logger;
24 import net.pterodactylus.util.logging.Logging;
25 import freenet.keys.FreenetURI;
28 * Helper class that creates {@link FreenetURI}s for Sone to insert to and
31 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
33 public class SoneUri {
36 private static final Logger logger = Logging.getLogger(SoneUri.class);
39 * Generate a Sone URI from the given URI.
42 * The URI to derive the Sone URI from
43 * @return The derived URI
45 public static FreenetURI create(String uri) {
47 return new FreenetURI(uri).setDocName("Sone").setMetaString(new String[0]);
48 } catch (MalformedURLException mue1) {
49 /* this should never happen. */
50 logger.log(Level.WARNING, String.format("Could not create Sone URI from URI: %s", uri), mue1);