Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: How to append data to a File

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
public class Append_File
 {
  public static void main(String[]

Java: how to get the Current Working Directory

import java.io.IOException;
public class WorkingDirectory 
{
  public static void main(String[] argv) throws IOException
  {
     String curDir = Sys

Java: How to get File size in bytes , Kilobyte and megabyte

import java.io.File;
public class Taille_Fichier
 {
  public static void main(String[] args)
  {
    File fichier = new File("D:/file.txt");
    long

Java: How to list available root directories

import java.io.File;
public class Disk_Ex
 {
  public static void main(String[] args)
  	{
    File[] list_root = File.listRoots();
    // Available 

Java: How to create temporary file in specified directory

import java.io.File;
import java.io.IOException;
public class File_TempPath
 {
  public static void main(String[] args) throws IOException
  	 {

Java: Create a file in read / write mode

import java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public class Fichiers_Permiss

Java: Change the permissions of a file

import java.io.File;
import java.io.IOException;
public class Rep_Att
 {
  public static void main(String[] argv) throws IOException
  	{
    File fi

Java: How to create a temporary file and delete it on exit

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class File_Temp
 {
  public static

Java: Read a CSV file

import java.io.BufferedReader;
import java.io.FileReader;
public class CSVFile
 {
  public static void main(String[] args) throws Exception
  	 {

Java: Moving a File or Directory to Another Directory

import java.io.File;
import java.io.IOException;
public class File_Depl
 {
  public static void main(String[] argv) throws IOException
  	{
    File

Java: Check if two files are in the same directory

import java.io.File;
public class File_Rep {
  public static void main(String[] args)
  	 {
    File fichier1 = new File("C:/test.txt");
    File fic

Java: How to work with temporary files

import java.io.File;
import java.io.IOException;
public class File_Temp
 {
  public static void main(String[] argv) throws IOException {
    // Create

Java: Copy the contents of a file to another

     FileInputStream src = new FileInputStream(fichier_source);
    FileOutputStream dest = new FileOutputStream(fichier_dest);
 
    FileChannel inChannel = src.getChannel();
    FileChannel outChannel = dest.getChannel();

Java: How to determine if File or Directory is hidden

import java.io.File;
public class File_Modes
 {
  public static void main(String[] args) {
    File file = new File("C:/test.txt");
    System.out.pr

Java: create a file in read-only mode

import java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.io.IOException;
p