Java中的 FilterInputStream簡介_動力節(jié)點(diǎn)Java學(xué)院整理
FilterInputStream 介紹
FilterInputStream 的作用是用來“封裝其它的輸入流,并為它們提供額外的功能”。它的常用的子類有BufferedInputStream和DataInputStream。
BufferedInputStream的作用就是為“輸入流提供緩沖功能,以及mark()和reset()功能”。
DataInputStream 是用來裝飾其它輸入流,它“允許應(yīng)用程序以與機(jī)器無關(guān)方式從底層輸入流中讀取基本 Java 數(shù)據(jù)類型”。應(yīng)用程序可以使用DataOutputStream(數(shù)據(jù)輸出流)寫入由DataInputStream(數(shù)據(jù)輸入流)讀取的數(shù)據(jù)。
FilterInputStream 源碼(基于jdk1.7.40)
package java.io; public class FilterInputStream extends InputStream { protected volatile InputStream in; protected FilterInputStream(InputStream in) { this.in = in; } public int read() throws IOException { return in.read(); } public int read(byte b[]) throws IOException { return read(b, 0, b.length); } public int read(byte b[], int off, int len) throws IOException { return in.read(b, off, len); } public long skip(long n) throws IOException { return in.skip(n); } public int available() throws IOException { return in.available(); } public void close() throws IOException { in.close(); } public synchronized void mark(int readlimit) { in.mark(readlimit); } public synchronized void reset() throws IOException { in.reset(); } public boolean markSupported() { return in.markSupported(); } }
以上所述是小編給大家介紹的Java中的 FilterInputStream簡介,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
java中java.util.Date和java.sql.Date之間的轉(zhuǎn)換的示例
java.util.Date是java.sql.Date的父類,有時候在和SqlServer數(shù)據(jù)庫打交道時,也會遇到,本文主要介紹了java中java.util.Date和java.sql.Date之間的轉(zhuǎn)換的示例,具有一定的參考價值,感興趣的可以了解一下2024-05-05SpringMVC 文件上傳配置,多文件上傳,使用的MultipartFile的實(shí)例
本篇文章主要介紹了SpringMVC 文件上傳配置,詳解介紹了如何使用SpringMVC進(jìn)行表單上的文件上傳以及多個文件同時上傳的步驟,有興趣的可以了解一下。2016-12-12Java使用TCP實(shí)現(xiàn)在線聊天的示例代碼
這篇文章主要介紹了Java使用TCP實(shí)現(xiàn)在線聊天的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-01-01maven package后Idea項目中找不到target文件的解決
在Idea中執(zhí)行mavenpackage打包后,target文件不顯示,點(diǎn)擊「ShowinExplore」可以在本地文件夾中查到,解決方法:在Idea的Maven工具窗口中,右鍵點(diǎn)擊項目,選擇Reimport,刷新項目即可2024-11-11java8 forEach結(jié)合Lambda表達(dá)式遍歷 List操作
這篇文章主要介紹了java8 forEach結(jié)合Lambda表達(dá)式遍歷 List操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-09-09