You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by anton huber <hu...@hotmail.com> on 2006/01/15 14:50:22 UTC
[VFS]: getContent().getSize() on hiberfil.sys failed
Hi!
On WindowsXP exists a special file (hiberfil.sys) for hibernation mode. When
i try
to determine if this file exists (with java.io.File or VFS) the result is
FALSE. (Regardless
if it really exists or not). (Seems to be a bug in JDK: 6192331.)
So with java.io.File i can determin the size of this file but with VFS i
can`t.
Someone knows a workaround to determine the size of this file?
-------------------------------------
Example (Code):
import java.io.File;
import org.apache.commons.vfs.*;
public class Hiberfil {
public static void main(String[] args) {
String path = "C:\\hiberfil.sys";
printFile(path);
printFileObject(path);
}
static void printFile(String path) {
File f = new File(path);
System.out.println("File.Exists -> "+f.exists());
System.out.println("File.Length -> "+f.length());
}
static void printFileObject(String path) {
try {
FileObject fo = VFS.getManager().resolveFile(path);
System.out.println("FileObject.Exists -> "+fo.exists());
System.out.println("FileObject.Content.Size ->
"+fo.getContent().getSize());
} catch (FileSystemException e) {
e.printStackTrace();
}
}
}
-------------------------------------
Example (Output):
File.Exists -> false
File.Length -> 469291008
FileObject.Exists -> false
org.apache.commons.vfs.FileSystemException: Could not determine the size of
"file:///C:/hiberfil.sys" because it is not a file.
at
org.apache.commons.vfs.provider.DefaultFileContent.getSize(DefaultFileContent.java:126)
at VFSTest.Hiberfil.printFileObject(Hiberfil.java:24)
at VFSTest.Hiberfil.main(Hiberfil.java:11)
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [VFS]: getContent().getSize() on hiberfil.sys failed
Posted by Mario Ivankovits <ma...@ops.co.at>.
anton huber schrieb:
> Hi!
> On WindowsXP exists a special file (hiberfil.sys) for hibernation
> mode. When i try
> to determine if this file exists (with java.io.File or VFS) the result
> is FALSE. (Regardless
> if it really exists or not). (Seems to be a bug in JDK: 6192331.)
> So with java.io.File i can determin the size of this file but with VFS
> i can`t.
>
> Someone knows a workaround to determine the size of this file?
None yet. But please add this to
http://issues.apache.org/bugzilla/show_bug.cgi?id=38105 .
This describes a similar problem on UNIX.
Thanks!
Mario
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org