|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.imageio.stream.ImageInputStreamImpl
javax.imageio.stream.FileImageInputStream
public class FileImageInputStream
從 File 或 RandomAccessFile 中獲取輸入的 ImageInputStream 的實作。假定檔案內容在物件的生存期內是穩定的。
| 欄位摘要 |
|---|
| 從類別 javax.imageio.stream.ImageInputStreamImpl 繼承的欄位 |
|---|
bitOffset, byteOrder, flushedPos, streamPos |
| 建構子摘要 | |
|---|---|
FileImageInputStream(File f)
建構一個將從給定 File 進行讀取的 FileImageInputStream。 |
|
FileImageInputStream(RandomAccessFile raf)
建構一個將從給定 RandomAccessFile 進行讀取的 FileImageInputStream。 |
|
| 方法摘要 | |
|---|---|
void |
close()
關閉串流。 |
protected void |
finalize()
在垃圾回收前結束此物件。 |
long |
length()
返回底層檔案的長度,如果其為未知,則返回 -1。 |
int |
read()
從串流中讀取單個位元組,並以 int(0 到 255 之間)形式返回該位元組。 |
int |
read(byte[] b,
int off,
int len)
從串流中讀取至多 len 個位元組,並將其存儲到 b 中(從 off 索引處開始)。 |
void |
seek(long pos)
將當前串流位置設置為所需的位置。 |
| 從類別 javax.imageio.stream.ImageInputStreamImpl 繼承的方法 |
|---|
checkClosed, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, setByteOrder, skipBytes, skipBytes |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public FileImageInputStream(File f)
throws FileNotFoundException,
IOException
File 進行讀取的 FileImageInputStream。
在建構此物件和最後一次調用 read 方法之間的時間內,一定不能更改檔案內容。
f - 要從其進行讀取的 File。
IllegalArgumentException - 如果 f 為 null。
SecurityException - 如果存在安全管理器,且不允許對檔案進行讀取存取。
FileNotFoundException - 如果 f 是目錄,或者由於任何其他原因不能打開以進行讀取。
IOException - 如果發生 I/O 錯誤。public FileImageInputStream(RandomAccessFile raf)
RandomAccessFile 進行讀取的 FileImageInputStream。
在建構此物件和最後一次調用 read 方法之間的時間內,一定不能更改檔案內容。
raf - 要從其進行讀取的 RandomAccessFile。
IllegalArgumentException - 如果 raf 為 null。| 方法詳細資訊 |
|---|
public int read()
throws IOException
ImageInputStreamImpl 複製的描述int(0 到 255 之間)形式返回該位元組。 如果到達 EOF,則返回 -1。
子類別必須提供此方法的實作。子類別實作在退出前應該更新串流位置。
在發生讀取前,串流中的位偏移量必須被重置為 0。
ImageInputStream 中的 readImageInputStreamImpl 中的 read-1。
IOException - 如果串流已經被關閉。
public int read(byte[] b,
int off,
int len)
throws IOException
ImageInputStreamImpl 複製的描述len 個位元組,並將其存儲到 b 中(從 off 索引處開始)。如果由於到達串流末尾而沒有讀取任何位元組,則返回 -1。
在發生讀取前,串流中的位偏移量必須被重置為 0。
子類別必須提供此方法的實作。子類別實作在退出前應該更新串流位置。
ImageInputStream 中的 readImageInputStreamImpl 中的 readb - 用來接收寫入的位元組陣列。off - b 中要寫入的起始位置。len - 要讀取的最大位元組數。
-1,指示 EOF。
IOException - 如果發生 I/O 錯誤。public long length()
-1。
ImageInputStream 中的 lengthImageInputStreamImpl 中的 lengthlong 形式返回檔案的長度,或者返回 -1。
public void seek(long pos)
throws IOException
ImageInputStream 複製的描述 如果 pos 小於刷新位置(由 getflushedPosition 返回),那麼將拋出 IndexOutOfBoundsException。
尋找檔案結束標記的後面是合法的,只有在該處執行讀取時才拋出 EOFException。
ImageInputStream 中的 seekImageInputStreamImpl 中的 seekpos - 一個 long,它包含所需的檔案指針位置。
IOException - 如果發生任何 I/O 錯誤。
public void close()
throws IOException
ImageInputStream 複製的描述IOException 或錯誤行為。調用此方法可允許實作此介面的類別釋放與串流關聯的資源,如記憶體、磁碟空間或檔案描述符。
ImageInputStream 中的 closeImageInputStreamImpl 中的 closeIOException - 如果發生 I/O 錯誤。
protected void finalize()
throws Throwable
close 方法來關閉所有開啟的輸入源。不應該從應用程序程式碼調用此方法。
ImageInputStreamImpl 中的 finalizeThrowable - 如果在父級類別終止過程中發生錯誤。
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。