SlideServe
Menu
Préférences
© SlideServe · v2026

IO in java

amora avatar
20 diapositives · 367 Views · Sep 18, 2014

IO in java. Stream. Character Stream Byte Stream. Character & ByteStream classes. FileWriter FileReader. Buffered Character Stream. BufferedReader BufferedWriter By buffering, no. of reads and writes to the physical device is reduced. BufferedWriter.

IO in java - slide 1
01 / 20IO in java
1 / 17

Télécharger la présentation

IO in java
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. IO in java

  2. Stream • Character Stream • Byte Stream

  3. Character & ByteStream classes

  4. FileWriter • FileReader

  5. Buffered Character Stream • BufferedReader • BufferedWriter By buffering, no. of reads and writes to the physical device is reduced.

  6. BufferedWriter • It buffers output to a character stream. • Constructor: BufferedWriter(Writer w) BufferedWriter(Writer w, intbufsize) Methods: same as Writer void newLine() throwsIOException program

  7. BufferedReader • It buffers input from character stream. • Constructor: BufferedReader(Reader r) BufferedReader (Reader r, intbufsize) Methods: same as Reader void readLine() throwsIOException program

  8. PrintWriter • It displays string equivalents of simple type such as int, float, char, etc.. • Constructor: PrintWriter(OutputStreamos) PrintWriter(OutputStreamos,booleanflushOnNewline) PrintWriter(Writer w) PrintWriter(Writer w, os,booleanflushOnNewline)

  9. Methods: print() println() program:

  10. ByteStream • OutputStream and InputStream class has same methods as FileWriter and FileReader.

  11. FileOutputStream • It allows you to write binary data to a file. • Constructor: FileOutputStream(String filePath) throws IOException FileOutputStream(File obj) throws IOException Program

  12. FileInputStream • It allows you to read binary data from a file. • Constructor: FileInputStream(String filePath) throws FileNotFoundException FileInputStream(File obj) throws FileNotFoundException Program

  13. DataOutputstream Class • It allows to write simple java types to byte output stream. • Constructor: DataOutputStream(OutputStreamos)

  14. Methods • void writeInt(inti) • Void writeBoolean(Boolean b) • Void writeByte(Byte b) • Void writeChar(inti) • Void writeDouble(double d) • Void writeFloat(float f) • Void writeLong(long l) • Void writeShort(short s) • Void writeUTF(String s) • Program

  15. DataInputStream • It allows to read simple java types from byte input stream. • Constructor: DataInputStream(InputStream is)

  16. Methods • byte readByte() • booleanreadBoolean • char readChar() • double readDouble() • float readFloat() • long readLong() • short readShort() • intreadInt() • string readUTF() • Program

  17. BufferedOutputStream • Buffers output to a byte stream. • Constructor: BufferedOutputStream(OutputStreamos) BufferedOutputStream(OutputStreamos, intbufSize) Program:

  18. BufferedInputStream • Buffers input from a byte stream. • Constructor: BufferedInputStream(InputStream is) BufferedInputStream(InputStream is, intbufSize) Program:

  19. Random Access File • Previous classes only use sequential access to read and write to a file. • This class allows to write programs that can seek to any location in a file to read & write data to that point. • Constructor: • RandomAccessFile(String filenm, String mode)

  20. Methods • void close() • long length() • int read() • int read(byte buffer[],int index, int size) • void seek(long n) • intskipByte(int n)