Video: Dab tsi yog input thiab output kwj?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
Nyeem thiab sau cov ntaub ntawv. Raws li tau piav ua ntej, a ntws tuaj yeem txhais tau tias yog ib ntu ntawm cov ntaub ntawv. InputStream yog siv los nyeem cov ntaub ntawv los ntawm ib qhov chaw thiab cov OutputStream yog siv los sau cov ntaub ntawv mus rau qhov chaw. Ntawm no yog ib tug hierarchy ntawm cov chav kawm los nrog Input thiab Output kwj.
Ib yam li ntawd, dab tsi yog qhov input kwj?
Kev nkag kwj : Yog tias koj nyeem cov ntaub ntawv los ntawm cov ntaub ntawv lossis lwm qhov chaw, ntws siv yog input ntws . Hauv cov ntsiab lus yooj yim input ntws ua raws li channel los nyeem cov ntaub ntawv. Tso zis kwj : Yog tias koj xav nyeem thiab ua cov ntaub ntawv los ntawm qhov chaw (cov ntaub ntawv thiab lwm yam) koj yuav tsum xub khaws cov ntaub ntawv, qhov txhais tau tias khaws cov ntaub ntawv yog tso zis ntws.
Tom qab, lo lus nug yog, dab tsi yog byte kwj hauv Java? Java Byte ntws yog siv los ua input thiab output ntawm 8-ntsis bytes , hos Java Cim ntws yog siv los ua cov tswv yim thiab tso tawm rau 16-ntsis Unicode. Txawm hais tias muaj ntau chav kawm ntsig txog tus cwj pwm ntws tab sis cov chav kawm siv feem ntau yog, FileReader thiab FileWriter.
Hais txog qhov no, vim li cas Java siv I O ntws?
Java Kuv/ O kwj is kev khiav ntawm cov ntaub ntawv uas koj ua tau los yog nyeem los ntawm, los yog koj ua tau sau rau. Nws yog siv los ua kev nyeem thiab sau cov haujlwm hauv cov ntaub ntawv mus tas li. Java siv cov kwj deg los ua cov haujlwm no. Java .io pob muab cov chav kawm rau kev tawm tswv yim thiab tso tawm los ntawm cov ntaub ntawv, network ntws , nco buffers, thiab lwm yam.
Stream piav qhia ntau hom kwj dej yog dab tsi?
Ob qhov tseem ceeb hom dej ntws yog sau ntws thiab nyeem ntawv ntws . Thaum sau ntawv ntws sau cov ntaub ntawv rau hauv qhov chaw (cov ntaub ntawv), nyeem ntawv ntws yog siv los nyeem cov ntaub ntawv los ntawm ib qhov chaw (file). Lub pob java.io muaj ntau tus cov chav kawm ntws uas muaj peev xwm ua tau txhua yam hom ntawm cov ntaub ntawv.
Pom zoo:
Dab tsi yog input thiab output nyob rau hauv angular?
Ua ntej tshaj plaws, lub tswv yim ntawm Input thiab Output yog sib pauv cov ntaub ntawv ntawm cov khoom. Lawv yog cov txheej txheem xa / tau txais cov ntaub ntawv los ntawm ib feem mus rau lwm qhov. Input yog siv los txais cov ntaub ntawv nyob rau hauv where Output yog siv los xa cov ntaub ntawv tawm. Cov zis xa tawm cov ntaub ntawv tawm los ntawm nthuav tawm cov khoom tsim tawm, feem ntau yog EventEmitter cov khoom
Input thiab output angular 4 yog dab tsi?
Ua ntej tshaj plaws, lub tswv yim ntawm Input thiab Output yog sib pauv cov ntaub ntawv ntawm cov khoom. Lawv yog cov txheej txheem xa / tau txais cov ntaub ntawv los ntawm ib feem mus rau lwm qhov. Input yog siv los txais cov ntaub ntawv nyob rau hauv where Output yog siv los xa cov ntaub ntawv tawm. Cov zis xa tawm cov ntaub ntawv tawm los ntawm nthuav tawm cov khoom tsim tawm, feem ntau yog EventEmitter cov khoom
Dab tsi yog qhov txawv ntawm input kwj thiab tso zis kwj hauv Java?
InputStream yog siv rau ntau yam uas koj nyeem los ntawm. OutputStream yog siv rau ntau yam uas koj sau rau. InputStream yog siv rau kev nyeem ntawv, OutputStream rau kev sau ntawv. Lawv txuas nrog ua tus dai kom zoo nkauj rau ib leeg xws li koj tuaj yeem nyeem / sau txhua hom ntaub ntawv sib txawv los ntawm txhua hom kev sib txawv
Qhov txawv ntawm kwj thiab MemoryStream yog dab tsi?
Kwj yog ib tug sawv cev ntawm bytes. Ob chav kawm no muab tau los ntawm chav kawm kwj uas yog paub daws teeb los ntawm kev txhais. Raws li lub npe qhia, FileStream nyeem thiab sau rau hauv cov ntaub ntawv thaum MemoryStream nyeem thiab sau rau hauv lub cim xeeb. Yog li nws hais txog qhov twg cov kwj tau khaws cia
Dab tsi yog qhov input thiab output hauv lej?
Nyob rau hauv lej, input thiab outputare cov nqe lus uas muaj feem xyuam rau cov dej num. Ob lub tswv yim thiab tawm ntawm ib qho kev ua haujlwm yog qhov sib txawv, uas txhais tau hais tias lawv hloov. Ib qho piv txwv yooj yim yog y = x2 (uas koj tuaj yeem sau f(x) = x2). Nyob rau hauv tas li ntawd, x yog inputand y yog cov zis