Java I/O Tutorial

The package contains almost every class you’ll ever need to perform input and output (I / O) in Java. The stream in the package supports many data such as primitives, object, localized characters, etc. IO is for input and output.

File I/O

example to create, read, write, modify, delete file and get the file’s information.

  1. Create a File
  2. Create a File in a directory
  3. How to delete a file or empty directory in java?
  4. How to delete a folder with files using Java?
  5. How to read a file in Java?
  6. How to create temporary file in Java?
  7. How to write data to temporary file in Java?
  8. How to delete temporary file in Java?
  9. How to get the temporary file path in Java?
  10. How to write a String to a File?
  11. How to write the contents of a file to standard output?
  12. How to append content to file?
  13. How to read a large text file line by line using Java?
  14. What’s the difference between getPath(), getAbsolutePath(), and getCanonicalPath() in Java?
  15. How To List All Files In Directory In Java?
  16. How to use a FilenameFilter to filter all content in directory in java?
  17. How to get the list of only Files in a directory in java?
  18. How to get the list of only directories in a directory in java?
  19. How to rename file in Java?
  20. How to copy file in Java?
  21. How to move file to another directory in Java?
  22. How to set the file permission in Java?
  23. How to check if a file exists in Java?
  24. How to get file size in Java?
  25. How to use getFreeSpace(), getTotalSpace() and getUsableSpace()?
  26. How to determine file creation date in Java?
  27. Get last Modified Date of Files
  28. Get File Extension in Java
  29. Delete files with a certain extension from a folder?
  30. How to find files with a certain extension from a folder?
  31. Write a byte[] into a file
  32. Convert a File to ByteArray
  33. Read/Convert an InputStream to a String
  34. Convert String to InputStream
  35. Read from standard inputin java
  36. Get Count of Lines in the file


File Compression and Decompression

  1. Creating zip archive in Java
  2. Extract a zip file in Java
  3. Compress a File in GZIP format in Java
  4. Extract gz/GZIP files in java