How to find the size of a dynamic webpage using java... eg : Youtube........

How to find the size of a dynamic webpage using java... eg : Youtube........

package newpack;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

/**
 * Main.java
 *
 * @author www.javadb.com
 */
public class Drive {

    /**
     * Reads a web page into a StringBuilder object
     * and prints it out to console along with the
     * size of the page.
     */
    public void getWebSite() {

        try {

            URL url = new URL("http://www.youtube.com/");
            URLConnection urlc = url.openConnection();

            BufferedInputStream buffer = new BufferedInputStream(urlc.getInputStream());

            StringBuilder builder = new StringBuilder();
            int byteRead;
            while ((byteRead = buffer.read()) != -1)
                builder.append((char) byteRead);

            buffer.close();

            System.out.println(builder.toString());
            System.out.println("The size of the web page is " + builder.length() + " bytes.");

        } catch (MalformedURLException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
    /**
     * Starts the program
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Drive().getWebSite();
    }
}


*******This code is giving 89 KB answer....
But i want to determine the content size as well...
Please help...


Thanks,
Ramit 
View Answers

March 18, 2013 at 10:25 AM

the above code is running on JAVA 1.6 and Eclipse.... Ramit









Related Tutorials/Questions & Answers:
How to find the size of a dynamic webpage using java... eg : Youtube........
How to find the size of a dynamic webpage using java... eg : Youtube... into a StringBuilder object * and prints it out to console along with the * size...()); System.out.println("The size of the web page is " + builder.length
How to find hashtable size in Java?
How to find hashtable size in Java?  Hi, What is the code for Hashtable in Java? How to find hashtable size in Java? Give me the easy code. Thanks
Advertisements
How to export the table content from an webpage to excel using java?
How to export the table content from an webpage to excel using java?  How to export the table content from an webpage to excel using java? The table contents are generated dynamically in that java page
How to export the table content from an webpage to excel using java?
How to export the table content from an webpage to excel using java?  How to export the table content from an webpage to excel using java? The table contents are generated dynamically in that java page
How to insert dynamic textbox values into database using Java?
How to insert dynamic textbox values into database using Java?  Hi I am trying to insert dynamic textbox values to database, my jsp form have 2... of dynamic textboxes with Name and Address will display....Now I want to Insert
How to add google page in my webpage using jquery ajax.
How to add google page in my webpage using jquery ajax.  Hi, I created a page index.html on desktop . this page content following code. <html>... not open on my browser. how google page will load using ajax. thanks
how to re size image proportionately using java for different images like jpeg, png, gif.
how to re size image proportionately using java for different images like jpeg, png, gif.  hi, i need sample code for re size image proportionately using java for different images like jpeg, png, gif, this code for my
Read Header/Footer Margin size using Java
Read Header/Footer Margin size using Java  Hi, Is it possible to read the "Header from Top" and "Footer from bottom" properties of a MS word document in Java? I have been searching the web for hours now, POI's and several other
Read Header/Footer Margin size using Java
Read Header/Footer Margin size using Java  Hi, Is it possible to read the "Header from Top" and "Footer from bottom" properties of a MS word document in Java? I have been searching the web for hours now, POI's and several other
how to send the content of jtextarea from netbeans IDE to webpage's textarea in java
how to send the content of jtextarea from netbeans IDE to webpage's textarea in java   Hi, i m interested to send the content of my jtextarea which i have developed in netbeans IDE to the webpage's textarea. how can i do
How to change image size before adding to mysql using jsp
How to change image size before adding to mysql using jsp  I want... the image size as per defined by me and then I want to store that image into my DB for example, i want to set image size 300x300. Plz help me out
give me source code of webpage creation using html
give me source code of webpage creation using html  how to create a webpage using html
making of dynamic textfields using swings
making of dynamic textfields using swings  How to make dynamic textfields using java swings
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
webpage
webpage  design a webpage student database using forms and frameset
How to decrease image thumbnail size in java?
How to decrease image thumbnail size in java?  Hi, I my web application I have to create the thumbnail size image from the image file uploaded by user. How to decrease image thumbnail size in java? Thanks
find all unique character in string using java
find all unique character in string using java  example: hello how are you. output should be waryu
how to find a dynamic string in a string & how to replace tgat wth with another string - JSP-Servlet
how to find a dynamic string in a string & how to replace tgat wth with another string  Dear sir, i have a ArrayList in that i have stored a values from a excel sheet specified column values and i have one string
displaying a calendar of only current month in jsp on webpage using javascript
displaying a calendar of only current month in jsp on webpage using javascript  how can we display a calendar of only current month in jsp on webpage using javascript
making of dynamic textfields using swings
making of dynamic textfields using swings  how to crate dynamic texfields by clicking on button
Find sum of all the elements of matrix using Java
Find sum of all the elements of matrix using Java A matrix is a rectangular array of numbers. The numbers in the matrix are called its entries or its elements. A matrix with m rows and n columns is called m-by-n matrix or m × n matrix
How to add dynamic table in java
How to add dynamic table in java  How to add dynamic table in java   import java.awt.*; import java.sql.*; import java.util.*; import javax.swing.*; import java.awt.event.*; import javax.swing.table.*; public class
What is the maximum size of a file that can be uploaded using PHP and how can we change this?
What is the maximum size of a file that can be uploaded using PHP and how can we change this?  What is the maximum size of a file that can be uploaded using PHP and how can we change
How to print a webpage without url and date in jsp ?
How to print a webpage without url and date in jsp ?  How to print a webpage without url and date in jsp
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]
Accessing MS ACCESS databse using a HTML webpage [created using Javascript... pressing the button - 'Submit'. the webpage includes fields like Name, Age, Sex... be displayed in a webpage after click the button - 'show details'. Could you pls help me
setting web page size
setting web page size  How to set the webpage size in Java
How can we get the properties (size, type, width, height) of an image using php image functions?
How can we get the properties (size, type, width, height) of an image using php image functions?  How can we get the properties (size, type, width, height) of an image using php image functions
How can we find the number of rows in a result set using PHP?
How can we find the number of rows in a result set using PHP?   How can we find the number of rows in a result set using PHP
Dynamic tree using textarea data
Dynamic tree using textarea data  I need to create a dynamic tree by using text area data(words) as child nodes in struts. Any body please help me. "very urgent". thanks in advance
how to do dynamic ally placeholder using properties or some else - JSP-Servlet
how to do dynamic ally placeholder using properties or some else   dear sir, how to use and declare a dynamic place holder in java? i have to send... column values should be fetch ,so how to use a place holder for this [column
webpage
webpage  java, servlet and JSPs to create a web page with a text box and a button named submit. after submitting i shpuld get a msg successfully added
Need to find the position of delimiter in a file using java - Java Beginners
Need to find the position of delimiter in a file using java  Hi , will any one give me a solution to find the Need to find the position of delimiters in a file using java.Please do reply
Java Class Size
Java Class Size  How to determine size of java class
Create Dynamic Table using Hubernate
Create Dynamic Table using Hubernate  Thank's for reading my Post. I...: How to create seperate table for all users they sign up for my web app. i need... files but i done create and update for a single table. i dono how to automate
Retrieve The Size of Slide Using Java
Retrieve The Size of Slide Using Java       In this example we are going to find height and width of the slide. In this example we create an object of dimension in which we are assigning the size
Iterator Java Size
The Java Iterator size() is the method of the collection Interface... in the collection. Java Size Iterator Example import java.util.*; public class size { public static void main(String[] args) { List list = new
Get all file size on FTP Server
In this section we are going to describe how to get size of FTP server files using java
what is the size of java class
what is the size of java class  Could anyone tell me how to find the size of the class given below. public class Sample { private int x; private int y; private char ch; public static void main(String[] args) { Sample
Techniques used for Generating Dynamic Content Using Java Servlets.
Techniques used for Generating Dynamic Content Common Gateway Interface... with Web Server, using CGI program you can't accomplish... applications that generates dynamic pages. Microsoft has
create webpage with table sql database using netbeans 6.8 with struts complete tutorial.(include username and password)
create webpage with table sql database using netbeans 6.8 with struts complete... webpage using java&j2ee.that webpage contain a home,carriers,contactus,about... with that project.i have an idea do create webpage using netbeans 6.8 version
how to add dynamic data
how to add dynamic data  how to add dynamic data to an existing web application
maximum size of arraylist - java
? 4.how many access specifier and how many access modifier in java? 5.what...maximum size of arraylist - java  1.what is the maximum size... and interface?   1) It depend on heap size of machine and heap size depend
Find Browser & it's version using jQuery
Find Browser & it's version using jQuery  Hi sir I heard that JQuery have some method which can be used to find the Browser name & its version...:20px; font-size:14px; } span { color:red; } </style> <script src
Find Successively Repeated Character using Java
Find Successively Repeated Character using Java In this section, we are going to find the successively repeated character using Regular Expression. For this, we have specified a word 'programming' and with use of Pattern and Matcher
Last modified time of a webpage
Last modified time of a webpage  how can we get the last modified time of a webpage using java
Java find prime numbers without using break statement
Java find prime numbers without using break statement In this tutorial, you will learn how to find the prime numbers without using break statement. You all are aware of Prime Numbers, these are the numbers which are either divided
Change Size of PowerPoint Slide Using Java
Change Size of PowerPoint Slide Using Java  ... then change the size of the slide. setPageSize(java.awt.Dimension pgsize): This method is used to change the size current page. The size of page is passed
How to find java jobs at any where in india
How to find java jobs at any where in india   Hi, I want information about java related jobs in india.where can i find that details
webpage capture
webpage capture   webpage capture source code using jsps and servlets

Ads