W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
public interface ObjectOutput
extends DataOutput, AutoCloseable
ObjectOutput 擴(kuò)展了 DataOutput 接口以包括對(duì)象的寫(xiě)入。 DataOutput 包括用于輸出原始類(lèi)型的方法,ObjectOutput 擴(kuò)展了該接口以包括對(duì)象、數(shù)組和字符串。
Since:
JDK1.1
修飾符和類(lèi)型 | 方法 | 描述 |
---|---|---|
void | close() | 關(guān)閉流。 |
void | flush() | 沖洗流。 |
void | write(byte[] b) | 寫(xiě)入一個(gè)字節(jié)數(shù)組。 |
void | write(byte[] b, int off, int len) | 寫(xiě)入一個(gè)子字節(jié)數(shù)組。 |
void | write(int b) | 寫(xiě)入一個(gè)字節(jié)。 |
void | writeObject(Object obj) | 將對(duì)象寫(xiě)入底層存儲(chǔ)或流。 |
從接口 java.io.DataOutput 繼承的方法 |
---|
writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
void writeObject(Object obj) throws IOException
將對(duì)象寫(xiě)入底層存儲(chǔ)或流。 實(shí)現(xiàn)此接口的類(lèi)定義了對(duì)象的編寫(xiě)方式。
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
obj | 要寫(xiě)入的對(duì)象 |
Throws:
Throw名稱(chēng) | Throw描述 |
---|---|
IOException | 任何常見(jiàn)的輸入/輸出相關(guān)異常。 |
void write(int b) throws IOException
寫(xiě)入一個(gè)字節(jié)。 此方法將阻塞,直到實(shí)際寫(xiě)入字節(jié)。
指定者:
寫(xiě)入接口DataOutput
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
b | 字節(jié) |
Throws:
Throw名稱(chēng) | Throw描述 |
---|---|
IOException | 如果發(fā)生 I/O 錯(cuò)誤。 |
void write(byte[] b) throws IOException
寫(xiě)入一個(gè)字節(jié)數(shù)組。 此方法將阻塞,直到實(shí)際寫(xiě)入字節(jié)。
指定者:
寫(xiě)入接口DataOutput
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
b | 要寫(xiě)入的數(shù)據(jù) |
Throws:
Throw名稱(chēng) | Throw描述 |
---|---|
IOException | 如果發(fā)生 I/O 錯(cuò)誤。 |
void write(byte[] b, int off, int len) throws IOException
寫(xiě)入一個(gè)子字節(jié)數(shù)組。
指定者:
寫(xiě)入接口DataOutput
參數(shù):
參數(shù)名稱(chēng) | 參數(shù)描述 |
---|---|
b | 要寫(xiě)入的數(shù)據(jù) |
off | 數(shù)據(jù)中的起始偏移量 |
len | 寫(xiě)入的字節(jié)數(shù) |
Throws:
Throw名稱(chēng) | Throw描述 |
---|---|
IOException | 如果發(fā)生 I/O 錯(cuò)誤。 |
void flush() throws IOException
沖洗流。 這將寫(xiě)入任何緩沖的輸出字節(jié)。
Throws:
Throw名稱(chēng) | Throw描述 |
---|---|
IOException | 如果發(fā)生 I/O 錯(cuò)誤。 |
void close() throws IOException
關(guān)閉流。 必須調(diào)用此方法來(lái)釋放與流關(guān)聯(lián)的任何資源。
指定者:
在接口 AutoCloseable 中關(guān)閉
Throws:
Throw名稱(chēng) | Throw描述 |
---|---|
IOException | 如果發(fā)生 I/O 錯(cuò)誤。 |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話(huà):173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: