[Polycasso-commit] SF.net SVN: polycasso:[51] trunk/polycasso/src/com/mebigfatguy/polycasso/ Random
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-11-25 05:42:14
|
Revision: 51
http://polycasso.svn.sourceforge.net/polycasso/?rev=51&view=rev
Author: dbrosius
Date: 2009-11-25 05:42:04 +0000 (Wed, 25 Nov 2009)
Log Message:
-----------
javadoc
Modified Paths:
--------------
trunk/polycasso/src/com/mebigfatguy/polycasso/RandomImageFinder.java
Modified: trunk/polycasso/src/com/mebigfatguy/polycasso/RandomImageFinder.java
===================================================================
--- trunk/polycasso/src/com/mebigfatguy/polycasso/RandomImageFinder.java 2009-11-25 04:22:39 UTC (rev 50)
+++ trunk/polycasso/src/com/mebigfatguy/polycasso/RandomImageFinder.java 2009-11-25 05:42:04 UTC (rev 51)
@@ -37,6 +37,9 @@
import org.apache.commons.io.IOUtils;
+/**
+ * finds an image on the web to try to draw with polygons
+ */
public class RandomImageFinder {
private static final String ROOTURL = "http://search.lycos.com/";
@@ -45,9 +48,19 @@
private static final Pattern IMAGE_PATTERN = Pattern.compile("image_url=([^&]*)&");
private static final int NAMELEN = 3;
+ /**
+ * private to avoid construction of this static access only class
+ */
private RandomImageFinder() {
}
-
+
+ /**
+ * finds an image thru lycos image search
+ *
+ * @return a random image
+ *
+ * @throws IOException if fetching resources at urls fails
+ */
public static Image findImage() throws IOException {
char[] ranName = new char[NAMELEN];
@@ -77,6 +90,14 @@
throw new IOException("Failed to find image");
}
+ /**
+ * retrieve arbitrary data found at a specific url
+ *
+ * @param url the url to retrieve
+ * @return a byte array of the content
+ *
+ * @throws IOException the site fails to respond
+ */
private static byte[] getUrlData(String url) throws IOException {
HttpURLConnection con = null;
InputStream is = null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|