Drive « Operation « Java I/O Q&A





1. Smart way of checking the hard drive?    coderanch.com

I want my Java application to check if the hard disk drive is full or not. If it is full I want the application to terminate itself. I could of course write 1 MB of dummy data to the disk and then delete it, but I was wondering if there is a smarter way. /Peter

2. Finding the drive type    coderanch.com

3. reading floppy drive    coderanch.com

Hi, Maybe I'm missing something simple here & I'd appreciate a pointer. As an exercise I want to create a class to read the entire contents of a floppy drive as bytes, (the idea is to read all files even though they may be deleted) and recover the deleted files. As I understand that to delete a file all that happens ...

4. Write to a tape drive on Solaris 8?    coderanch.com

5. Can't write directly to a drive?    coderanch.com

Lets say I want to rewrite part of a floppies DOS File System header. It does not seem that Java allows you to just open up //./a: and start writing to it. I can open up //./a: and read the first 512 bytes and then write that to a txt file and look at the info in a hex editor. However ...

6. How to detect a CD inserted into a drive    coderanch.com

Hey people, Does anyone know, how to detect an event, when user inserts CD into CD drive? Loox like there`s gonna be a different solution for each OS plattform. I tried to ask already a couple of people, but they only said I need to go thru NATIVE methods and call either C++ or Delphi functions which deal with WM_CHANGEDEVICE (in ...

7. Hard drive search    coderanch.com

Hi, Welcome to JavaRanch! Not only possible, but easy. Something like this gets asked in our I/O and Streams forum about once a week, so I'm going to move this post over there. Meanwhile, the answer is basically to use the java.io.File class. Find the filesystem roots using the appropriate method in that class, use one of the listXXX methods to ...

8. Search for a file in a drive    coderanch.com

Well, I was presuming you already had some code to go through directories of files. Perhaps using the listFiles method of the File class. In that case I was suggesting you use the file size as the main comparison method. IMHO timestamps are not reliable enough since (esp in Windows) they sometimes seem to change a lot. But the matching method ...

9. Direct Hard Drive Access In Java    coderanch.com

Hello, Is there a way to access a hard drive (or USB device) in Java without having to use the file system. For example, is there a way to open an input stream to a hard drive and a make a direct image copy of that drive? Linux c programs like dd_rescue do this quite well but who wants to work ...





10. Parsing XML from local system's D Drive    coderanch.com

11. Request Dispatcher access file in another drive    coderanch.com

Hi, We have a website that was supposed to open-up a text file when a link is selected. It had been implemented using res.getRequestDispatcher("//a.txt"); RequestDispatcher.forward(res,resp); But now we are running short of space in server machine and hence need to move text files to a new location (on a separate system with a different ip). The requestDispatcher doesn't work. e.g requestDispatcher ...

12. file parsing in drive (how many drives )    coderanch.com

public class DriveTest { public static void main(String p[]) { File fileObjectList[] = File.listRoots(); for( int i = 0;i< fileObjectList.length ; i++) { //System.out.println("############## "+ i+" ###############"); if(fileObjectList[i].isDirectory()) { System.out.println("directory ---> "+fileObjectList[i].getName()); if(!(fileObjectList[i].getName().equals("System Volume Information")) ) { //directoryNames.add(fileObjectList[i].getName()); //DiskParser.doParseDirectory(fileObjectList[i]); } } else { System.out.println("files ---> "+fileObjectList[i].getName()); //fileNames.add(fileObjectList[i].getName()); //allFiles.add(fileObjectList[i].getAbsolutePath()); } //System.out.println("********************************* DIC SIZE ----> "+directoryNames.size()+" FILES SIZE ---> "+fileNames.size()); } } } ...

13. hwo do i read file from local systems D: drive ???    coderanch.com

Ah. Your code is running in an application server. In which case all you need do is put your resource in the classpath and read it in just as you were trying to do originally. However, you neeed to read the JavaDocs to see how you define where the resource is (an absolute path, like the one you have above, will ...

14. Searching files from a drive and displaying them in an window    coderanch.com

Dear all, It might be the simple question. Please give me best answer. I have an external disk. I want to search for what files exists in that disk and wants display them in an window(ie in GUI). And later i want select one or more files from them and then want read them to my local host memory. And later ...

15. What is httpd.conf file?? i can't find this file on my hard drive!    forums.oracle.com

What tutorials are you reading? That file configures the Apache httpd web server, nothing to do with Glassfish, or any other JEE component at all. There isn't really an equivalent for Glassfish, as they're different products, that do different, slightly overlapping things. What are you trying to achieve? Perhaps you're trying to use Apache httpd as a front-end to Glassfish?