Top "Java-io" questions

The java.

Best way to Pipe InputStream to OutputStream

I was to trying to find the best way to pipe the InputStream to OutputStream. I don't have an option …

java pipe java-io
Java. How to append text to top of file.txt

I need to add text to beggining of text file via Java. For example I have test.txt file with …

java file text append java-io
java IO to copy one File to another

I have two Java.io.File objects file1 and file2. I want to copy the contents from file1 to file2. …

java file file-io io java-io
Delete Files with same Prefix String using Java

I have around 500 text files inside a directory with a same prefix in their filename say dailyReport_. The latter part …

java filenames java-io
Scanner on text file hasNext() is infinite

I'm writing a simple program in Java and it requires reading data from a text file. However, I'm having trouble …

java java.util.scanner java-io
Basics - reading/writing remote files using Java

I started with requirement of reading and writing files in from/in a directory on a remote Ubuntu machine. First, …

java file-io java-io
Use of FilenameFilter

I have a directory: File dir = new File(MY_PATH); I would like to list all the files whose name …

java file-io java-io
Correct way to close nested streams and writers in Java

Note: This question and most of its answers date to before the release of Java 7. Java 7 provides Automatic Resource Management …

java java-io
File.mkdir() and mkdirs() are creating file instead of directory

I use the following code: final File newFile = new File("/mnt/sdcard/test/"); newFile.mkdir(); // if I use mkdirs() result …

android java-io
PrintWriter add text to file

In my online computer science class I have to write a program to determine the surface gravity on each planet …

java file-io java-io printwriter