JustPaste.it

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FreenetGrabber
{
private static final Pattern pattern = Pattern.compile("/((USK|CHK|SSK|KSK)[^/]{1,})/([^\"]{1,})");

public static void main(String[] args)
{
InputStream is = null;
StringBuffer sb = new StringBuffer();

try
{
URL url = new URL("http://127.0.0.1:8888/downloads/");
is = url.openStream(); // throws an IOException
BufferedReader br = new BufferedReader(new InputStreamReader(is));

String line;
while ((line = br.readLine()) != null)
{
sb.append(line+"\n");
}
}
catch (MalformedURLException mue)
{
mue.printStackTrace();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
finally
{
try
{
if (is != null) is.close();
}
catch (IOException ioe)
{
// NO-OP
}
}

Matcher m = pattern.matcher(sb.toString());

while (m.find())
{
System.out.println("Key: " + m.group(1) + " Path: " + m.group(3));
}
}
}