io in java n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
IO in java PowerPoint Presentation
Download Presentation
IO in java

Loading in 2 Seconds...

play fullscreen
1 / 20

IO in java - PowerPoint PPT Presentation


  • 112 Views
  • Uploaded on

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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'IO in java' - amora


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
stream
Stream
  • Character Stream
  • Byte Stream
slide4

FileWriter

  • FileReader
buffered character stream
Buffered Character Stream
  • BufferedReader
  • BufferedWriter

By buffering, no. of reads and writes to the physical device is reduced.

bufferedwriter
BufferedWriter
  • It buffers output to a character stream.
  • Constructor:

BufferedWriter(Writer w)

BufferedWriter(Writer w, intbufsize)

Methods: same as Writer

void newLine() throwsIOException

program

bufferedreader
BufferedReader
  • It buffers input from character stream.
  • Constructor:

BufferedReader(Reader r)

BufferedReader (Reader r, intbufsize)

Methods: same as Reader

void readLine() throwsIOException

program

printwriter
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)

slide9

Methods:

print()

println()

program:

bytestream
ByteStream
  • OutputStream and InputStream class has same methods as FileWriter and FileReader.
fileoutputstream
FileOutputStream
  • It allows you to write binary data to a file.
  • Constructor:

FileOutputStream(String filePath) throws IOException

FileOutputStream(File obj) throws IOException

Program

fileinputstream
FileInputStream
  • It allows you to read binary data from a file.
  • Constructor:

FileInputStream(String filePath) throws FileNotFoundException

FileInputStream(File obj) throws FileNotFoundException

Program

dataoutputstream class
DataOutputstream Class
  • It allows to write simple java types to byte output stream.
  • Constructor:

DataOutputStream(OutputStreamos)

methods
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
datainputstream
DataInputStream
  • It allows to read simple java types from byte input stream.
  • Constructor:

DataInputStream(InputStream is)

methods1
Methods
  • byte readByte()
  • booleanreadBoolean
  • char readChar()
  • double readDouble()
  • float readFloat()
  • long readLong()
  • short readShort()
  • intreadInt()
  • string readUTF()
  • Program
bufferedoutputstream
BufferedOutputStream
  • Buffers output to a byte stream.
  • Constructor:

BufferedOutputStream(OutputStreamos)

BufferedOutputStream(OutputStreamos, intbufSize)

Program:

bufferedinputstream
BufferedInputStream
  • Buffers input from a byte stream.
  • Constructor:

BufferedInputStream(InputStream is)

BufferedInputStream(InputStream is, intbufSize)

Program:

random access file
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)
methods2
Methods
  • void close()
  • long length()
  • int read()
  • int read(byte buffer[],int index, int size)
  • void seek(long n)
  • intskipByte(int n)