... or if you just open it as a RandomAccessFile and say raf.length(); That
should give the length isn't it ?!
where raf is the handle which holds the reference to the file.

Rishi


Paresh Gheewala wrote:

> 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
begin:vcard
n:Asthana;Rishi
tel;fax:1-732-548-4009
tel;home:1-732-635-3597
tel;work:1-732-548-0087
x-mozilla-html:FALSE
org:NetCom Systems, Inc;Software Development
adr:;;116,Copperfield Ln                ;Metuchen;NJ;08840;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Systems Consultant
x-mozilla-cpt:;-3936
fn:Rishi Asthana
end:vcard

Reply via email to