CodesJava

Easy learning with example program codes

make a read only file writable java

The setWritable() method of File class is used to make a read only file writable in java. It takes a boolean value as a parameter.

Example:

package
Read More
Posted in IO   

check if file is writable java program

The canWrite() method of File class is used to check if file is writable java. It returns true if the specified file is writable else return false.… Read More

Posted in IO   

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

Posted in 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

Posted in 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

Posted in IO   

write byte content to a file java program

Example:

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

write string content to a file java

Example:

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

delete temporary file java program

Example:

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

store data into temporary file java

Example:

package com.codesjava;
 
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
Posted in IO   


Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki