Java I/O Examples

The Java I/O means Java Input/Output. It is provided by the java.io package. This package has an InputStream and OutputStream. Java InputStream is defined for reading the stream, byte stream and array of byte stream.

Java I/O Examples

The Java I/O means Java Input/Output. It is provided by the java.io package. This package has an InputStream and OutputStream. Java InputStream is defined for reading the stream, byte stream and array of byte stream.

Java I/0 Examples

Java I/0 Examples

     

  1. What is Java I/O?
    The Java I/O means Java Input/Output. It is provided by the java.io package. This package has an InputStream and OutputStream. Java InputStream is defined for reading the stream, byte stream and array of byte stream.
  2. Classes and Interfaces of the I/O Streams
    The following listing of classes provided by the java.io package shown in the given table.
     
  3. Reading Text from the Standard Input 
    Java provides the standard I/O facilities for reading text through either from the file or from the keyboard on command line. This program illustrates how to use standard input to read the user input.
  4. Working With the Files
    The File class deals with the machine dependent files in a machine-independent manner i.e. it is easier to write platform-independent code that examines and manipulates files using the File class. This class is available in the java.lang package.

Video: Learn Java I/O packages

  1. Working with a Directory
    In the section, you will learn how a directory is created. Apart from this, you will also be aware from some manipulations that are performed 
    on a directory.

  2. Filter I/O Streams
    Like I/O streams, Filter streams are also used to manipulate the data reading from an underlying stream.. Apart from this,
    it allows the user to make a chain using multiple input stream so that, the operations that are to be applied on this chain, may create a combine effects on several filters. 
  3. Overview of I/O Data Streams
    Data streams are filtered streams that perform binary I/O operation on primitive data type values ( boolean, char, byte, short, int, long, etc.) as well as on String values. If you need to work with data that is not represented as bytes or characters then you can use Data Streams.
  4. Using a Random Access File
    n this section, you will learn about the Random Access File class provided by java. io package. This is a class that allows you to read and write arbitrary bytes, text, and primitive Java data types from or to any specified location in a file. 

     
  5. Converting a Filename Path to a URL
    In this section, you will learn, how a Filename path is converted to a URL and vice versa . URL stands for Uniform Resource Locator.
        
  6. Making Tokens of a Java Source Code
    In Java, The StreamTokenizer class is used for simple parsing of a Java source file into tokens. This class takes an input stream, breaks up the ASCII text in a file and parses it into "tokens". It allows the tokens to be read one at a time.
      
  7. Introduction to Encoding
    Java programs use Unicode text internally. It supports standard UTF-8 when reading and writing strings through the InputStreamReader and the OutputStreamWriter.
  8.  
  9. Serializing an Object
    Serialization
    is the process of saving an object in a storage medium (such as a file, or a memory buffer) or to transmit it over a network connection in binary form.
      
  10. Deserializing an Object
    The opposite operation of the serialization is called deserialization i.e. to extracting the data from a series of bytes is s known as deserialization
        
  11. Delete file or Directory
    In this example we are discussing the deletion of a file or a directory by using a java program. We pass the file name or the directory name to which we want to delete.
       
  12. Downloading and Viewing html source of a page i.e. running on the server
    This section illustrates you the procedure of viewing complete html code of a page i.e. running on the server.
     
  13. URL file Download and Save in the Local Directory
    This Program file download  from  URL and save this Url File in the specified directory. This program specifies the directory path where the files to be stored  as first command line argument and second command line arguments specifies URL File to be stored.
      
  14. Create XML file from flat file and data insert into database
    In this section, we have developed an application to create xml file from flat file and data insert  into database in Java. 
      
  15. Miscellaneous 

  16. Delete File Example
    In this section, you will learn how to delete a file.
     
  17. Buffer Reader
    In this section you will learn how to read line by line data from a file using BufferedReader.
     
  18. File Input Stream
    Java has Two types of streams- Byte & Characters.
     
  19. File Output Stream
    As we discussed earlier, java has two kinds of streams- Byte & Characters.
     
  20. Last Modified Date
    This section contains the detail about how to get the last modification date of a file.
     
  21. Java File Handling
    For file handling in java, the package known as java.io is available.
     
  22. File Compare
    In this section, we will discuss how to compare pathname of two file for the equality of their path.
     
  23. Read File Buffered Writer Example
    In this section, you will learn how to write to a file using BufferedWriter.
     
  24. Copy File Example
    In this section, you will learn how to copy content of one file into another file.
     
  25. File Handling In Java
    In this section we will discussed about How files can be handled in Java.
  26. Java I/O Byte Streams
    In this section we will discussed the I/O Byte Streams.
  27. Java I/O Character Streams
    In this section we will discuss the I/O Character Streams.
  28. Java I/O Buffered Streams
    In this section we will discuss the I/O Buffered Streams.
  29. Java I/O Data Streams
    In this tutorial we will discuss the Java I/O Data Streams.
  30. Java I/O Object Streams
    In this section we will discuss the Java IO Object Streams.
  31. Scanning and Formatting in Java
    In this we will discuss about the Java I/O Scanning and Formatting.
  32. Java I/O From the Command Line
    In this section we will learn about the I/O from the command line in Java.
  33. Java IO Path
    In this section we will discuss about the Java IO Path.
  34. Java Path Class
    In this section we will discuss all the aspect of Path class of Java.
  35. Java IO InputStream Example
    In this section we will discuss about the InputStream in Java.
  36. Java Byte Streams Example
    In this section we will discuss how to read one byte at a time from the input stream.
  37. Java IO SequenceInputStream Example
    In this tutorial we will learn about the SequenceInputStream class.
  38. Java FileInputStream
    In this section we will discuss about the Java IO FileInputStream.
  39. Java PipedInputStream
    In this example we will discuss about the Java PipedInputStream.
  40. Java ObjectInputStream
    In this example we will discuss about the Java class ObjectInputStream.
  41. Java FilterInputStream Example
    In this tutorial we will discuss about the FilterInputStream class in Java.
  42. Java IO OutputStream
    In this section we will read about the OutputStream class of java.io package.
  43. Java FileOutputStream Example
    In this section we will discuss about the Java IO FileOutputStream.
  44. Java ByteArrayOutputStream Example
    In this section we will discuss about the Java IO Byte Streams ByteArrayOutputStream class.
  45. Java PipedOutputStream
    In this tutorial we will discuss about the Java PipedOutputStream.
  46. Java PipedInputStream and PipedOutputStream
    In this section we will discuss about the PipedInputStream and PipedOutputStream in Java.
  47. Java ObjectOutputStream
    In this tutorial we will discuss about the Java class ObjectOutputStream.
  48. Java ObjectOutputStream ObjectInputStream
    In this section we will discuss about the ObjectOutputStream and ObjectInputStream in Java.
  49. Java FilterOutputStream Example
    In this section we will discuss about the FilterOutputStream class in Java.
  50. Java IO Reader
    In this section we will discuss about the Reader class in Java.
  51. Java IO FileReader
    In this tutorial we will learn about the FileReader class in Java.
  52. Java IO BufferedReader
    In this section we will discuss about the BufferedReader class in Java.
  53. Java IO CharArrayReader
    In this tutorial we will learn about the CharArrayReader class in Java.
  54. Java IO FilterReader
    In this section we will learn about the FilterReader class in Java.
  55. Java IO StringReader
    In this section we will discuss about the StringReader class in Java.
  56. Java IO InputStreamReader
    In this section we will discuss about the InputStreamReader in Java.
  57. Java IO PipedReader
    In this section we will discuss about the PipedReader in Java.
  58. Java IO LineNumberReader
    In this tutorial we will learn about the LineNumberReader in Java.
  59. Java PushbackReader
    In this section we will discuss about the PushbackReader class in Java.
  60. Java IO Writer
    In this section we will discuss about the Writer class in Java.
  61. Java IO BufferedWriter
    In this section we will discuss about the BufferedWriter class in Java.
  62. Java IO CharArrayWriter
    In this tutorial we will learn about the CharArrayWriter in Java.
  63. Java IO FilterWriter
    In this example we will discuss about the FilterWriter in Java.
  64. Java IO OutputStreamWriter
    In this section we will learn about the Java OutputStreamWriter.
  65. Java IO PipedWriter
    In this tutorial we will learn about the PipedWriter in Java.
  66. Java IO PrintWriter
    In this tutorial we will learn about the the PrintWriter class in Java.
  67. Java IO StringWriter
    In this section we will discussed about the StringWriter in Java.
  68. Command Line Standard Input In Java
    In this section we will discuss about the Java IO Standard Input through Command Line.
  69. Command Line Standard Output In Java
    In this section we will discuss about the Command Line Java IO Standard Output.
  70. Command Line Standard Error In Java
    In this section we will discuss about the Command Line Java IO Standard Error.
  71. How To Read String From Command Line In Java
    In this section we will discuss about how string can be read through the command line.
  72. How To Read Integer From Command Line In Java
    In this section we will discuss about how an integer can be read through the command line.
  73. Java IO File
    In this section we will discuss about the File class in Java.
  74. How To Create a New File
    In this section we will discuss about how to create a new file in Java.
  75. How To Read File In Java
    In this section we will discuss about about how data of a file can be read in Java.
  76. Java Construct File Path
    In this section we will discuss about how to construct file path in Java.