Peb puas yuav kaw BufferedReader?
Peb puas yuav kaw BufferedReader?

Video: Peb puas yuav kaw BufferedReader?

Video: Peb puas yuav kaw BufferedReader?
Video: KOJ NYOB PUAS KAJ SIAB TUB TSWB Wwj( nkauj tawm tshiab )2023 2024, Kaum ib hlis
Anonim

Thaum twg koj tiav nyeem cov cim los ntawm BufferedReader koj yuav tsum nco ntsoov kaw nws. Kaw a BufferedReader tseem yuav kaw Tus nyeem ntawv piv txwv los ntawm qhov twg BufferedReader yog nyeem.

Ua raws li qhov xav tau, nws puas tsim nyog kaw BufferedReader hauv Java?

tus kaw () txoj kev ntawm BufferedReader khoom yuav hu ua abstract kaw () txoj kev ntawm Reader chav kawm uas yuav kawg hu rau txoj kev siv hauv InputStreamReader chav kawm, uas tom qab ntawd kaw cov khoom InputStream. Yog li, tsuas yog bReader. kaw () txaus lawm. Koj xwb Yuav tsum kaw tus bufferedReader i.e nyeem.

Ib sab saum toj no, tus nyeem ntawv buffered ua dab tsi? BufferedReader yog ib chav kawm hauv Java uas nyeem cov ntawv los ntawm cov cim nkag, tsis kam cov cim thiaj li muab kev nyeem ntawv zoo ntawm cov cim, kab thiab arrays. Cov tsis pub qhov loj me yuav raug teev tseg. Yog tias tsis yog, qhov loj me me, uas tau hais ua ntej, yuav raug siv.

Yog li ntawd, kuv puas yuav tsum kaw cov ntaub ntawv hauv Java?

Qhov tseeb, Cov ntaub ntawv ua tsis txawm muaj a kaw () txoj kev. Tsuas yog cov peev txheej xwb xav tau ua kaw . Hauv java ua API muaj qhov sib cuam tshuam Closeable Interface, cov chav kawm siv qhov kev sib tshuam no lawv xav tau ua kaw tom qab siv. Nws kaw cov kwj deg thiab tso tawm txhua qhov kev pab cuam cuam tshuam nrog nws.

Kuv yuav siv buffered nyeem ntawv li cas?

Java BufferedReader class method Nws yog siv los nyeem cov cim rau hauv ib feem ntawm ib qho array. Nws yog siv los ntsuam xyuas cov input kwj txhawb rau lub cim thiab pib dua txoj kev. Nws yog siv los nyeem ib kab ntawv. Nws yog siv los ntsuam xyuas seb cov tswv yim kwj puas npaj tau los nyeem.

Pom zoo: