lengthpublic long length()Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.
Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist
Throws:
SecurityException - If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the fileeg:File file = new File(filepathname);
long len = file.length()
Returns:
The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist
Throws:
SecurityException - If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the fileeg:File file = new File(filepathname);
long len = file.length()
System.out.println(file.length());
File file1=new File(homepagepath);
System.out.println(file1.length());
-----------
Class File -lengthpublic long length()
Returns the length of the file denoted by this abstract pathname.Returns:The length, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not existThrows:SecurityException - If a security manager exists and its SecurityManager.checkRead(java.io.FileDescriptor) method denies read access to the file
long length = file.length();
当前路径名所指向的文件的字节数 或者为0改文件不存在