Task.ProgressMonitor
Class InputStreamUIHookSupport

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by Task.ProgressMonitor.InputStreamUIHookSupport
All Implemented Interfaces:
java.io.Closeable

public class InputStreamUIHookSupport
extends java.io.FilterInputStream

InputStreamUIHookSupport is used to notify a UIHookIF that IO operations are being performed and to report the status of the IO operation. Contrary to what you would think, this class reports the WRITE status (not READ status). This class is used by HttpMBClient to send the POST request. The POST method uses chunking, and the bytes are read, then sent to the service... therefore, the reads tell us the "SEND status", not the "RECIEVE status".

Since:
Sep 30, 2007, 3:41:37 PM
Version:
1.0
Author:
Nazmul Idris

Nested Class Summary
static class InputStreamUIHookSupport.Type
           
 
Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
InputStreamUIHookSupport(InputStreamUIHookSupport.Type type, UIHookIF uiHook, java.net.HttpURLConnection method)
           
InputStreamUIHookSupport(InputStreamUIHookSupport.Type type, UIHookIF uiHook, java.io.InputStream in)
          Constructs an object to monitor the progress of an input stream.
 
Method Summary
 void close()
          Overrides FilterInputStream.closeInUI to closeInUI the progress monitor as well as the stream.
 UIHookIF getUIHook()
          Get the ProgressMonitor object being used by this stream.
 int read()
          Overrides FilterInputStream.read to update the progress monitor after the read.
 int read(byte[] b)
          Overrides FilterInputStream.read to update the progress monitor after the read.
 int read(byte[] b, int off, int len)
          Overrides FilterInputStream.read to update the progress monitor after the read.
 void reset()
          Overrides FilterInputStream.reset to reset the progress monitor as well as the stream.
 long skip(long n)
          Overrides FilterInputStream.skip to update the progress monitor after the skip.
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputStreamUIHookSupport

public InputStreamUIHookSupport(InputStreamUIHookSupport.Type type,
                                UIHookIF uiHook,
                                java.io.InputStream in)
Constructs an object to monitor the progress of an input stream.

Parameters:
in - The input stream to be monitored.

InputStreamUIHookSupport

public InputStreamUIHookSupport(InputStreamUIHookSupport.Type type,
                                UIHookIF uiHook,
                                java.net.HttpURLConnection method)
                         throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getUIHook

public UIHookIF getUIHook()
Get the ProgressMonitor object being used by this stream. Normally this isn't needed unless you want to do something like change the descriptive text partway through reading the file.

Returns:
the ProgressMonitor object used by this object

read

public int read()
         throws java.io.IOException
Overrides FilterInputStream.read to update the progress monitor after the read.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Overrides FilterInputStream.read to update the progress monitor after the read.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides FilterInputStream.read to update the progress monitor after the read.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides FilterInputStream.skip to update the progress monitor after the skip.

Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Overrides FilterInputStream.closeInUI to closeInUI the progress monitor as well as the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterInputStream
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Overrides FilterInputStream.reset to reset the progress monitor as well as the stream.

Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException


Copyright © 2011. All Rights Reserved.