— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet418/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   414   415   416   417   418   419   420   421   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

System.out.println(dirContents[i]);
}
}
List the contents of a directory
3
System.out.println(dir.getAbsolutePath());
Get the absolute path of a fi le or directory
4
boolean isDeleted = f.delete();
Delete a fi le or directory (returns true if 
successful)
5
An address is NOT the 
same as the actual 
house! A File object is 
like a street address... 
it represents the name 
and location of a par-
ticular file, but it isn’t 
the file itself.


serialization 
and
file I/O
you are here
4
453
String
BufferedWriter
(a chain stream that 
works with characters)
is written to
String is put into a buffer 
with other Strings
FileWriter
(a connection stream 
that writes characters 
as opposed to bytes)
“Aspen Denver Boulder”
When the buffer is full, the 
Strings are all written to
Aspen
Denver
Boulder
File
destination
is chained to
“Boulder”
“Boulder”
“Denver”
“Aspen”
The beauty of buffers
If there were no buffers, it would be like 
shopping without a cart. You’d have to 
carry each thing out to your car, one soup 
can or toilet paper roll at a time.
The cool thing about buffers is that they’re much more effi cient than 
working without them. You can write to a fi le using FileWriter alone, by 
calling write(someString), but FileWriter writes each and every thing you 
pass to the fi le each and every time. That’s overhead you don’t want or 
need, since every trip to the disk is a Big Deal compared to manipulating 
data in memory. By chaining a BufferedWriter onto a FileWriter, the 
BufferedWriter will hold all the stuff you write to it until it’s full. Only when 
the buffer is full will the FileWriter actually be told to write to the fi le on disk. 
If you do want to send data before the buffer is full, you do have control.

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   414   415   416   417   418   419   420   421   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish