新聞中心
ObjectInput

沛縣網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),沛縣網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為沛縣上千余家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請找那個售后服務(wù)好的沛縣做網(wǎng)站的公司定做!
public interface ObjectInput
extends DataInput, AutoCloseableObjectInput 擴展了 DataInput 接口以包括對象的讀取。 DataInput 包括用于輸入原始類型的方法,ObjectInput 擴展了該接口以包括對象、數(shù)組和字符串。
Since:
JDK1.1
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| int | available() | 返回可以在不阻塞的情況下讀取的字節(jié)數(shù)。 |
| void | close() | 關(guān)閉輸入流。 |
| int | read() | 讀取一個字節(jié)的數(shù)據(jù)。 |
| int | read(byte[] b) | 讀入一個字節(jié)數(shù)組。 |
| int | read(byte[] b, int off, int len) | 讀入一個字節(jié)數(shù)組。 |
| Object | readObject() | 讀取并返回一個對象。 |
| long | skip(long n) | 跳過 n 個字節(jié)的輸入。 |
| 從接口 java.io.DataInput 繼承的方法 |
|---|
| readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes |
方法詳情
readObject
Object readObject() throws ClassNotFoundException, IOException
讀取并返回一個對象。 實現(xiàn)此接口的類定義了從何處“讀取”對象。
返回:
從流中讀取的對象
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| ClassNotFoundException | 如果找不到序列化對象的類。 |
| IOException | 如果發(fā)生任何常見的輸入/輸出相關(guān)異常。 |
read
int read() throws IOException
讀取一個字節(jié)的數(shù)據(jù)。 如果沒有可用的輸入,此方法將阻塞。
返回:
讀取的字節(jié),如果到達流的末尾,則為 -1。
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IOException | 如果發(fā)生 I/O 錯誤。 |
read
int read(byte[] b) throws IOException
讀入一個字節(jié)數(shù)組。 此方法將阻塞,直到某些輸入可用。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| b | 讀取數(shù)據(jù)的緩沖區(qū) |
返回:
實際讀取的字節(jié)數(shù),到達流末尾時返回-1。
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IOException | 如果發(fā)生 I/O 錯誤。 |
read
int read(byte[] b, int off, int len) throws IOException
讀入一個字節(jié)數(shù)組。 此方法將阻塞,直到某些輸入可用。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| b | 讀取數(shù)據(jù)的緩沖區(qū) |
| off | 數(shù)據(jù)的起始偏移量 |
| len | 讀取的最大字節(jié)數(shù) |
返回:
實際讀取的字節(jié)數(shù),到達流末尾時返回-1。
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IOException | 如果發(fā)生 I/O 錯誤。 |
skip
long skip(long n) throws IOException
跳過 n 個字節(jié)的輸入。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| n | 要跳過的字節(jié)數(shù) |
返回:
跳過的實際字節(jié)數(shù)。
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IOException | 如果發(fā)生 I/O 錯誤。 |
available
int available() throws IOException
返回可以在不阻塞的情況下讀取的字節(jié)數(shù)。
返回:
可用字節(jié)數(shù)。
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IOException | 如果發(fā)生 I/O 錯誤。 |
close
void close() throws IOException
關(guān)閉輸入流。 必須調(diào)用以釋放與流關(guān)聯(lián)的任何資源。
指定者:
在接口 AutoCloseable 中關(guān)閉
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IOException | 如果發(fā)生 I/O 錯誤。 |
新聞標(biāo)題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSObjectInput
瀏覽路徑:http://www.dlmjj.cn/article/cohpigs.html


咨詢
建站咨詢
