import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
public class TestProject {
static String body="";
public static String CheckString(String ss,String ss1,String deli)
{
StringTokenizer tk=new StringTokenizer(ss,deli);
while(tk.hasMoreElements())
{
String ff=tk.nextToken();
if(ff.equalsIgnoreCase(ss1))
return ff;
}
return "";
}
public String getData(String str)
{
try{
URL url=new URL(str);
String body="";
BufferedWriter out=new BufferedWriter(new FileWriter("web-Content.htm"));
BufferedReader br=new BufferedReader(new InputStreamReader(url.openStream()));
while(br.readLine()!=null)
{
if(br.readLine()==null)
break;
body+=br.readLine();
}
out.write(body);
br.close();
out.close();
return body;
}catch(Exception e){ return body; }
}
public static void main(String[] args) throws IOException {
String str="http://www.mobimonsterit.com/";
}
}
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
public class TestProject {
static String body="";
public static String CheckString(String ss,String ss1,String deli)
{
StringTokenizer tk=new StringTokenizer(ss,deli);
while(tk.hasMoreElements())
{
String ff=tk.nextToken();
if(ff.equalsIgnoreCase(ss1))
return ff;
}
return "";
}
public String getData(String str)
{
try{
URL url=new URL(str);
String body="";
BufferedWriter out=new BufferedWriter(new FileWriter("web-Content.htm"));
BufferedReader br=new BufferedReader(new InputStreamReader(url.openStream()));
while(br.readLine()!=null)
{
if(br.readLine()==null)
break;
body+=br.readLine();
}
out.write(body);
br.close();
out.close();
return body;
}catch(Exception e){ return body; }
}
public static void main(String[] args) throws IOException {
String str="http://www.mobimonsterit.com/";
}
}
import static org.junit.Assert.*;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import org.junit.Test;
public class TestProjectTest {
String str;
@Test
public void test() {
String ss=new TestProject().getData("http://www.google.com/");
assertEquals("google", TestProject.CheckString(ss,"google", ".,:"));
}
}