鴻蒙OS ReliableFileDescriptor.AutoCloseFileInputStream

2022-04-27 16:30 更新

ReliableFileDescriptor.AutoCloseFileInputStream

java.lang.Object

|---java.io.InputStream

|---|---java.io.FileInputStream

|---|---|---ohos.rpc.ReliableFileDescriptor.AutoCloseFileInputStream

public static class ReliableFileDescriptor.AutoCloseFileInputStream
extends FileInputStream

表示一個文件輸入流,其文件描述符在此流關(guān)閉時自動關(guān)閉。

此類僅適用于同一設(shè)備上的操作。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
AutoCloseFileInputStream(ReliableFileDescriptor reliablefd) 用于使用 ReliableFileDescriptor 對象創(chuàng)建 AutoCloseFileInputStream 實例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
void close() 關(guān)閉此 AutoCloseFileInputStream 對象,其 ReliableFileDescriptor 對象也將自動關(guān)閉。
int read() 從此 AutoCloseFileInputStream 對象中讀取一個整數(shù)。
從類 java.io.FileInputStream 繼承的方法
available, finalize, getChannel, getFD, read, read, skip
從類 java.io.InputStream 繼承的方法
mark, markSupported, reset
從類 java.lang.Object 繼承的方法
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構(gòu)造函數(shù)詳細信息

AutoCloseFileInputStream

public AutoCloseFileInputStream(ReliableFileDescriptor reliablefd)

用于使用 ReliableFileDescriptor 對象創(chuàng)建 AutoCloseFileInputStream 實例的構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
reliablefd 指示要使用的 ReliableFileDescriptor 對象。

方法詳情

close

public void close() throws IOException

關(guān)閉此 AutoCloseFileInputStream 對象,其 ReliableFileDescriptor 對象也將自動關(guān)閉。

指定者:

在接口 AutoCloseable 中關(guān)閉

指定者:

在接口Closeable中關(guān)閉

覆蓋:

在類 FileInputStream 中關(guān)閉

Throws:

Throw名稱 Throw描述
IOException 如果發(fā)生 I/O 錯誤,則引發(fā)此異常。

read

public int read() throws IOException

從此 AutoCloseFileInputStream 對象中讀取一個整數(shù)。

覆蓋:

讀入類 FileInputStream

返回:

返回整數(shù)。

Throws:

Throw名稱 Throw描述
IOException 如果發(fā)生 I/O 錯誤,則引發(fā)此異常。
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號