Or you could just use the File.length() method of the java.io.File class.
It's much simpler.
    (*Chris*)

----- Original Message -----
From: "Paresh Gheewala" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 27, 1999 2:16 AM
Subject: Reply: size of file


> Hi,
> To find the size of the file. Write the following code in your class file.
> Note: This is skeleton of the complete source code.
>
> import java.io.*;
> try {
>         FileInputStream instream = new FileInputStream("test.txt");
>         int inBytes = instream.available();
>         byte inBuff[] = new byte[inBytes];
>         int bytesRead = instream.read(inbuff,0,inBytes);
>       }
>
> I hope that you have got the solution !!!!!!!!!!!!!!!
>
> Paresh
>
>   ------------E-Card For Paresh M Gheewala----------------
>   [EMAIL PROTECTED] / Software Engineer ( R & D )
>   [ Versaware Technologies (I) Pvt. Ltd. ]
>   Visit : http://www.versaware.com
>   ---------------T h a n k   Y o u -----------------------
>
>
>
> xin wrote:
>
> > Hi!
> >
> > Does anyone know how to get the size of a file in Java?
> > Any help is appreciated.
> >
> > regards,
> > Jacqueline
> >
> > =====
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> >
___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to