انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Files in Java - Section (2)

الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 3
أستاذ المادة مهدي عبادي مانع الموسوي       22/12/2015 12:10:33
3.1. Byte Streams
The following sections describe the fundamental byte stream

3.1.1 The InputStream Methods
The following three methods provide access to the data from the input stream:
The three basic read methods are:
int read()
// return an int from input stream, which contains either a byte read from the stream or a -1
It means The java.io.InputStream.read() method reads the next byte of the data from the the input stream and returns int in the range of 0 to 255. If no byte is available because the end of the stream has been reached, the returned value is -1.
int read(byte[] buffer)
// read the stream into a byte array and return the number of bytes read
int read(byte[] buffer, int offset, int length)
// read the stream into a byte array and return the number of bytes read , the two int arguments in the third method indicate a sub range in the target array that needs to be filled

Other methods include:
void close()
//it closes the stream
long skip(long n)
//this method discards the specified number of bytes from the stream.
3.1.2 The OutputStream Methods
These methods write to the output of stream:
The three basic write methods are:
void write(int c)//
void write(byte[] buffer)
void write(byte[] buffer, int offset, int length)

• Other methods include:
void close()
void flush()// output stream uses it to force write when the write accumulate before committing


المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .