Home Answers Viewqa Java-Magazine How to find the size of a dynamic webpage using java... eg : Youtube........

 
 


Ramit Das
How to find the size of a dynamic webpage using java... eg : Youtube........
1 Answer(s)      2 months and a day ago
Posted in : Java Magazine

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 Pages:
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
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
Object Adapter based on Dynamic Proxy,java,Dynamic Object Adapter using Dynamic Proxies,newsletter,tutorial
, specifically on how to use dynamic proxies in Java to autogenerate code... The Java Specialists' Newsletter [Issue 108] - Object Adapter based on Dynamic Proxy... Object Adapter using Dynamic Proxies Now that we have seen
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
webpage
webpage  design a webpage student database using forms and frameset
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
setting web page size
setting web page size  How to set the webpage size in Java
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
making of dynamic textfields using swings
making of dynamic textfields using swings  How to make dynamic textfields using java swings
Dynamic Proxies - Short Tutorial
Dynamic Proxies - Short Tutorial 2001-01-18 The Java Specialists' Newsletter [Issue 005] - Dynamic Proxies - Short Tutorial Author: Dr. Christoph G.... Welcome to our fifth "The Java(tm) Specialists' Newsletter", published
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
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
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
Generic Types with Dynamic Decorators - Java Tutorials
Generic Types with Dynamic Decorators 2001-10-24 The Java Specialists...' Newsletter", in which we look at how we can apply the dynamic decorators to produce... asking if I had some nice examples for using the Dynamic Proxies of JDK 1.3. I
Dynamic web pages
Dynamic web pages  hi, i am just creating a web page using html and javascript. i want to give it a eye catching look using javascript. I just want to know how could i make it happen using javascript functions,like zoom in &
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
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
Create dynamic page through JSP
how to create dynamic page. This code shows one by one record of student from... Create dynamic page through JSP...; in the Tomcat server. Before running this java code you need mysql connector jar
webpage capture
webpage capture   webpage capture source code using jsps and servlets
How to adjust a size of a pdf file
How to adjust a size of a pdf file       In this program we are going to tell you how we can adjust the size of a pdf file irrespective of the fact whether it exists
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
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 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
making of dynamic textfields using swings
making of dynamic textfields using swings  how to crate dynamic texfields by clicking on button
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
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
what is the default buffer size for bufferedreader
by Line - Java Tutorial. Above example teaches you how to write programs...what is the default buffer size for bufferedreader  Hi, I am writing a program in Java for reading the big text file. I want to know what
JSP - Problem of displaying result at webpage
to solve my problem below. My webpage has problem in displaying result position. The result should be display below my title. How do i solve it? Thank you so...; <font color="#FFFFFF" size="4">ADSL Number
Java Class Size
Java Class Size  How to determine size of java class
copy something from a webpage to my webpage
copy something from a webpage to my webpage  How can I copy something from a webpage to my webpage
TheWindow Size and Position
Java Notes: Window Size and Position   Learn how to set the Window Size and Position in swing based application.   setLocationRelativeTo...()); f.validate(); // Make sure layout is ok Fixed Window Size using
Open InternetExplorer Webpage with Java - Java Beginners
Open InternetExplorer Webpage with Java  Hello Sir I want to Open my webpage from swing application when I Click On "VISIT US" Boutton then website will be display How I can Create it on Button Click.  Hi Friend
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
JSP: Dynamic Linking - JSP-Servlet
JSP: Dynamic Linking  Hi I am fetching data as a search result from database and displaying it in a table(id and name)using while(rs.next()){...}.I... inside your result set loop to provide them a dynamic link. JSP Code
FTP Server: Get Buffer size
FTP Server: Get Buffer size This tutorial helps you to get the current internal buffer size on FTP server using java. Get Buffer Size : You can find out the current internal buffer size for your data socket by using the FTPClient
size of the image - Java Server Faces Questions
size of the image  Hello, how to set the size of the image while Inserting image in the pdf file using i text  Hi friend,import java.io..../java
size of all primitive data
size of all primitive data   java program for to find the size of all primitive data types in java
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
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
ARRAY SIZE!!! - Java Beginners
ARRAY SIZE!!!  Hi, My Question is to: "Read integers from... don't know it's size (and I don't want to ask the user to enter it's size... solution for this question. Here goes my code: I just don't know how
calculate size of array
calculate size of array  Is it possible to calculate the size of array using pointers in Java
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
How to find the first 6 characters of string in regex?
need the syntax to find the first 6 characters of string in regex using java...How to find the first 6 characters of string in regex?  How to find the first 6 characters of string in regex. I know the Syntax
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 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 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
ARRAY SIZE. - Java Beginners
ARRAY SIZE.  Thanks, well that i know that we can use ArrayList...(A * 2); System.out.println(B); // Don't know how to print...); System.out.println(B); // Don't know how to print array B in this case. System.out.print

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.