2 * Sone - SoneUri.java - Copyright © 2013–2019 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 public class SoneUri {
35 private static final Logger logger = getLogger(SoneUri.class.getName());
38 * Generate a Sone URI from the given URI.
41 * The URI to derive the Sone URI from
42 * @return The derived URI
44 public static FreenetURI create(String uri) {
46 return new FreenetURI(uri).setDocName("Sone").setMetaString(new String[0]);
47 } catch (MalformedURLException mue1) {
48 /* this should never happen. */
49 logger.log(Level.WARNING, String.format("Could not create Sone URI from URI: %s", uri), mue1);