Initial Commit

Initial commit of project.
This commit is contained in:
Alex Stewart
2019-03-09 01:21:44 -08:00
parent e54e9653ed
commit 13420951b1
124 changed files with 5883 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
package network;
import java.io.*;
import java.net.*;
import offline.Ref;
public class NetworkWolfram
{
private static Integer num = 1;
public String getWolfram(String input) throws IOException
{
String name = null;
synchronized(num)
{
name = "wolfram_" + num;
++num;
}
URL url = new URL("http://api.wolframalpha.com/v1/simple?appid=" + Ref.wolfRamID + "&i="
+ URLEncoder.encode(input, "UTF-8"));
InputStream in = new BufferedInputStream(url.openStream());
OutputStream out = new BufferedOutputStream(new FileOutputStream(name + ".png"));
for ( int i; (i = in.read()) != -1; )
{
out.write(i);
}
in.close();
out.close();
return name + ".png";
}
}