View Javadoc

1   package fr.in2p3.jsaga.impl.job.instance.stream;
2   
3   import org.ogf.saga.error.*;
4   
5   import java.io.IOException;
6   import java.io.InputStream;
7   
8   /* ***************************************************
9   * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
10  * ***             http://cc.in2p3.fr/             ***
11  * ***************************************************
12  * File:   GetterInputStream
13  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
14  * Date:   23 mai 2008
15  * ***************************************************
16  * Description:                                      */
17  /**
18   *
19   */
20  public class GetterInputStream extends Stdout {
21      private GetterBufferedInputStream m_buffer;
22      private InputStream m_stream;
23  
24      public GetterInputStream(InputStream stdout) throws NotImplementedException, DoesNotExistException, TimeoutException, NoSuccessException {
25          m_buffer = new GetterBufferedInputStream(stdout);
26          m_stream = stdout;
27      }
28  
29      public void closeJobIOHandler() throws PermissionDeniedException, TimeoutException, NoSuccessException {
30          // do nothing
31      }
32  
33      /////////////////////////////////// interface InputStream ///////////////////////////////////
34  
35      public int read() throws IOException {return this.stream().read();}
36      public int read(byte[] b) throws IOException {return this.stream().read(b);}
37      public int read(byte[] b, int off, int len) throws IOException {return this.stream().read(b, off, len);}
38      public long skip(long n) throws IOException {return this.stream().skip(n);}
39      public void close() throws IOException {this.stream().close();}
40  
41      /////////////////////////////////////// private method ///////////////////////////////////////
42  
43      private InputStream stream() throws IOException {
44          //todo: use stream when buffer is empty
45          return m_buffer;
46      }
47  }