|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
javax.swing.ProgressMonitorInputStream
public class ProgressMonitorInputStream
監視讀取某些 InputStream 的進度。大致用以下形式調用此 ProgressMonitor:
InputStream in = new BufferedInputStream(
new ProgressMonitorInputStream(
parentComponent,
"Reading " + fileName,
new FileInputStream(fileName)));
這可以創建一個進度監視器,以監視讀取輸入串流的進度。如果需要一段時間,將會彈出 ProgressDialog,以通知使用者。如果使用者單擊 Cancel 按鈕,則在進行下一次讀取操作時會拋出 InterruptedIOException。當關閉串流時,會執行所有的正確清除。
有關此內容的更多文檔和範例,請參閱 The Java Tutorial 中的 How to Monitor Progress 一節。
ProgressMonitor,
JOptionPane| 欄位摘要 |
|---|
| 從類別 java.io.FilterInputStream 繼承的欄位 |
|---|
in |
| 建構子摘要 | |
|---|---|
ProgressMonitorInputStream(Component parentComponent,
Object message,
InputStream in)
建構一個物件,以監視輸入串流的進度。 |
|
| 方法摘要 | |
|---|---|
void |
close()
覆寫 FilterInputStream.close,以便關閉進度監視器以及串流。 |
ProgressMonitor |
getProgressMonitor()
獲取此串流使用的 ProgressMonitor 物件。 |
int |
read()
覆寫 FilterInputStream.read,以便在讀取之後更新進度監視器。 |
int |
read(byte[] b)
覆寫 FilterInputStream.read,以讀取之後更新進度監視器。 |
int |
read(byte[] b,
int off,
int len)
覆寫 FilterInputStream.read,以便在讀取之後更新進度監視器。 |
void |
reset()
覆寫 FilterInputStream.reset,以重置進度監視器以及串流。 |
long |
skip(long n)
覆寫 FilterInputStream.skip,以便在跳過之後更新進度監視器。 |
| 從類別 java.io.FilterInputStream 繼承的方法 |
|---|
available, mark, markSupported |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public ProgressMonitorInputStream(Component parentComponent,
Object message,
InputStream in)
message - 要在對話框(如果彈出)中放置的描述性文本。parentComponent - 觸發被監視操作的元件。in - 要監視的輸入串流。| 方法詳細資訊 |
|---|
public ProgressMonitor getProgressMonitor()
public int read()
throws IOException
FilterInputStream.read,以便在讀取之後更新進度監視器。
FilterInputStream 中的 read-1。
IOException - 如果發生 I/O 錯誤。FilterInputStream.in
public int read(byte[] b)
throws IOException
FilterInputStream.read,以讀取之後更新進度監視器。
FilterInputStream 中的 readb - 存儲讀取資料的緩衝區。
-1。
IOException - 如果發生 I/O 錯誤。FilterInputStream.read(byte[], int, int)
public int read(byte[] b,
int off,
int len)
throws IOException
FilterInputStream.read,以便在讀取之後更新進度監視器。
FilterInputStream 中的 readb - 存儲讀取資料的緩衝區。off - 目標陣列 b 中的起始偏移量。len - 讀取的最大位元組數。
-1。
IOException - 如果發生 I/O 錯誤。FilterInputStream.in
public long skip(long n)
throws IOException
FilterInputStream.skip,以便在跳過之後更新進度監視器。
FilterInputStream 中的 skipn - 要跳過的位元組數。
IOException - 如果串流不支持搜尋,或者發生其他 I/O 錯誤。
public void close()
throws IOException
FilterInputStream.close,以便關閉進度監視器以及串流。
Closeable 中的 closeFilterInputStream 中的 closeIOException - 如果發生 I/O 錯誤。FilterInputStream.in
public void reset()
throws IOException
FilterInputStream.reset,以重置進度監視器以及串流。
FilterInputStream 中的 resetIOException - 如果已經標記了該串流,或者標記已經無效。FilterInputStream.in,
FilterInputStream.mark(int)
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。