🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #61

File.lengh() return 0 while the file's length > 0 on Linux

#61
From: Chris
Date: Thu, 17 Mar 2005 07:02
17 lines
1401 bytes
Howdy, 

When using File.length to get the size of a file on linux, it returns 0;
but I am sure the file has contents, Could someone give me a hint?

Thanks in advance .

//test.java
import java.io.*;
public class test
{
       public static void main(String args[])
       {
               File file = new File("/proc/mdstat");
               System.out.println("file.length(): " + file.length());
       }
}
Technical Details
Message-ID: <42392992@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1089d0,de041f602cc051c9,start
X-Google-Attributes: gid1089d0,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Chris" <wangguoqian@gmail.com>
Newsgroups: borland.public.jbuilder.java.api
Subject: File.lengh() return 0 while the file's length > 0 on Linux
Date: Thu, 17 Mar 2005 15:02:15 +0800
Lines: 18
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-2022-jp"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 60.176.200.101
Message-ID: <42392992@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1111042450 60.176.200.101 (16 Mar 2005 22:54:10 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail