Professional Documents
Culture Documents
Byte Strtamu
BytSrcanms uanty the data in he Jotm of fndvidual byt
-Byte 3treama cay fnthen valus &at andu m 0-255
&reams ana weul to harlle teat, mades, audto
video
h a two A0p abstract danes o Byle reams
1) Inut tam
)Output Shea
bye A-hpukStrea
/Pele Lnput Shrtan DadanputSheam
bjectloput 8trta Lne urnbeopugham
nput &treom Ctlten nput rar
Bauud IopukShream
Colstrack clan)Ppedlo put gtrcan Paahlock.nput 9tream
Seguneapuk Stream
Shringbulteloput
8ean
tbh levd Sream.
(owiu dolo
Aatveam 18 o ou o data. A ateom
om on plase to ano ther
» uive te olo o n tnput
3ttama mul
devita and nd e chlo to an outpud deyiu
Streama Can be calepbctzed into fnpu adput sbrearns
- Input trcami heod -e dolo. unrn
}le edc.
kybeand ,
rmonsteta t.
he dala to he
Srcams wyd te
Output
- A he atrtarn clanu u avaslabe in jova io poco
Byte Streams
. Chanasker Sram.
IO
Chanud &romns
Byle &rcams
Wsto
Reodan
lnputSbrcam Output Sfrean
(o -65535)
Co- 255) UNICDDÉé
ASCI
31
Lo leve streama
void u i t (tyeti b)
id fush)
Puhes hi output Sheam and fdus any butad op
vofd clo)
atbiam a ulsasns an4 A4it
oss ouput
anouated th stu
HaAOUMA
-Ala is a clan tm java.fo
delmatiu o danpoah
Raading e dala m a
impdtt Java.io.,
public cla flkkead
Hs.do);
Hs. Lad t) 65 A
eaad jav 6
6
D
ABCDE abt.ht
(fale.
Chanat tuams
characteu of eah
uunn daBa a
haoc stuams
om 0-65535.
faadu n oUR wo upen abshoct
elanes of
choac AUam
.Readu
9. Wsto.
LinilumberRandu
Butud Resdas
ChasArroy Kaadas
fPenda
Read nputShrearmKeadu
PudhbarkRendaa
(obstact da AluRerdu
RltuRerdey
Prre Roade
grin Reods
buuadhika
ChasArayh u
QulputSteam hkika >#lWsst
wole
Calostiout dloun Alatu
Prped skea
PintWsba
high
Raading e dala tan a sndng o arot F
Publc co Dmo
tos.cloC
)
&ptinout-pnotn(");
cath (l0fnceyHan)
ava
N
ABC de t
fos( "doP t , uuu);
- Cut append hen
Byte Streams. L
imp6tt java.io.*;
public elam Dem
bs na buljendOutputSteam (fos);
BuludotputStrcan
fnt k
ohi (Ck= bi*.saad t)) t-1)
bo g.wsdk (k) ; wxitng to y3 ila
Condo.
SysTen.ouk-println (cuhau)k ); l(printing on
Deno
boaile Vva
bis. uLad )
+8IS
fos
43 bat
FLS
abt t
we ConMiden onuy Frlenput &tcam, fillout put Shrcam, the CtUso
Buiheudoputrcan BufJud
o Contentu oto a bulhes airq
CuAput Stram.
* Bufkaadnput Srtan Buuud outpukSeam.
strearns uohith Caunnot open a
Then Ther ane htgh level byte
dine
ercl ghream
aluwa on lbw
y depend
Auloput Stream AleouspukStrcam
a
o shrcam4, we can pa
-As per he uulk o chaining
Louw levelarams objut au a paameta to a high level
Condukot
aha
oljec o ilunput9hrcam namky kr
-Ho t pamed an
atram Conutuehs
8uudnput
a pasameto o e highlevel
Strtam. his mproves he podmanu
impdtt ava.io.*
publi clas Demo
ubl slatc
publie void main (Shing agl1) hsouu louuplion
dos. cle )
s.clok C9:
s clo C)
dts clo O,
bis.clo C)
s. cloC)
Dmo.java i s . dis.uadline )
doa wtkBybeat )
-B1S
-B0s
-Fi
-Pos abe t t
y3tnt
o treams
Chaining
Jeadlinel) DIS eade a ine as a whok and 9etuns it as a
octs.
ndofAu
he
mefhod ehunnd null i
Lt
v s aanira at Compie tSme,
String.
and
deprecated
hadlinet)
eneukes
pvorams
wsib Btu (String) who Une ak-a time in dsttnalon
le.
*ChanadunGrearns.
hanatten atreams.
to
toPY to using low lercl
intk
ohib ((k -tnend ( )) ! -1)
ts. clentD;
tand t
L aoc tat
chanarb sbuams. u
Loto leve
4Cap4
t Copu Fl to wain
impdtt Java.fo. *,
puubltc lam Huor
l0ercaption
ahl3) haouu
puLblicslati
void main(4nng
AleReade"abl.tt);
rReadas frenew
Alttu daf-hd ", tu),
le fo
tuolent)5
impot ava.10. t
cdas Demo
puublc
rouu Onpko.
l0Enuuption
alati vod main (Stung ar3)
public
whi ( sI=
Ls.AaadLine C«)).. nul))
PRINTLN METHOD.
- Ouut
objut ond it
slandasd InputStream
Sstam.ío: epusnt
epvent shandad hput Devíca.
and it apnunu
out:uhut
Pintsheam objeck
Systüm.
standad o u t Dévíta
cdom
to he hputStrtam
ds Doahputlhaan(Sytaro.1n );
Dalanput Stua
nuo
I Lowlerel
ALReada fv*nuo tkReaden ('abc.tht)DS
level
Bueud Rendes br nauoBujeudReadeu ( ) | bigh
in
1 s Leth bulunqeet eading ect Come4
Butnd Readr.
l Osing ogut loutput Strearn4, the dada ln yooad
Rading
ending it to ilk.
DalalnputSream
ditnuw DadalnpetSrtam (Sysunio);
SAing at
Sauro.out.printh (" Entor tent);
tr = dis .
uad Line ( );
Spstaro,outprintlnl4k)
ALOutrutStream ossnuo AlkoutpdSream ( "ak.tmt"); //c
DadaOput8hrean ds uo DhaOsrateam Jo)
dbe.wAibbyk«(sr);
3