make a file read only java

The setReadOnly() method of File class is used to make a file read only in java. It returns true is the operation is successful else return false.… Read More

Categories IO

rename file in java program

The renameTo() method of File class is used to rename the existing file in java. It returns true if the specified file is renamed successfully otherwise returns … Read More

Categories IO

delete file in java program

The delete() method of File class is used to delete the existing file in java. It returns true if the specified File deleted successfully otherwise returns false.… Read More

Categories IO

write byte content to a file java program

Example:

package com.w3spoint;
 
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
 
public class WriteByteToFileTest {
  public static void main(String args[
Read More
Categories IO

write string content to a file java

Example:

package com.w3spoint;
 
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
 
public class WriteByteToFileTest {
  public static void main(String args[
Read More
Categories IO

delete temporary file java program

Example:

package com.w3spoint;
 
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
 
public class TempFileDelete {
  public static void main(String args[
Read More
Categories IO

store data into temporary file java

Example:

package com.w3spoint;
 
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.Writer;
 
public class WriteStringToFileTest {
  public static void main(
Read More
Categories IO