KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ve > luz > ica > remoteio > RemoteInputStreamImpl


1 /*
2  * Copyright (c) 2003 by The Jackass Team
3  * Licensed under the Open Software License version 2.0
4  */

5 package ve.luz.ica.remoteio;
6
7 import java.io.IOException JavaDoc;
8 import java.io.InputStream JavaDoc;
9
10 //import org.apache.commons.logging.Log;
11
//import org.apache.commons.logging.LogFactory;
12

13 /**
14  * Implementation class for the RemoteInputStream interface.
15  * @author Carlos Arévalo
16  */

17 public class RemoteInputStreamImpl extends RemoteInputStreamPOA
18 {
19     //private static Log LOG = LogFactory.getLog(RemoteInputStreamImpl.class);
20

21     private InputStream JavaDoc inputStream = null;
22
23     /**
24      * Class constructor
25      * @param stream the input stream that will be accesed remotely
26      */

27     RemoteInputStreamImpl(InputStream JavaDoc stream)
28     {
29         this.inputStream = stream;
30     }
31
32     /**
33      * @see ve.luz.ica.remoteio.RemoteInputStreamOperations#read(ve.luz.ica.remoteio.OctetSequenceHolder, int)
34      */

35     public int read(OctetSequenceHolder b, int len) throws RemoteIOException
36     {
37         try
38         {
39             b.value = new byte[len];
40             int numBytes = inputStream.read(b.value, 0, len);
41             return numBytes;
42         }
43         catch (IOException JavaDoc e)
44         {
45             throw new RemoteIOException(e.getMessage());
46         }
47     }
48
49     /**
50      * @see ve.luz.ica.remoteio.RemoteInputStreamOperations#close()
51      */

52     public void close() throws RemoteIOException
53     {
54         try
55         {
56             this.inputStream.close();
57         }
58         catch (IOException JavaDoc e)
59         {
60             throw new RemoteIOException(e.getMessage());
61         }
62     }
63
64     /**
65      * @see ve.luz.ica.remoteio.RemoteInputStreamOperations#available()
66      */

67     public int available() throws RemoteIOException
68     {
69         try
70         {
71             return this.inputStream.available();
72         }
73         catch (IOException JavaDoc e)
74         {
75             throw new RemoteIOException(e.getMessage());
76         }
77     }
78
79     /**
80      * @see ve.luz.ica.remoteio.RemoteInputStreamOperations#mark(int)
81      */

82     public void mark(int readlimit)
83     {
84         this.inputStream.mark(readlimit);
85     }
86
87     /**
88      * @see ve.luz.ica.remoteio.RemoteInputStreamOperations#markSupported()
89      */

90     public boolean markSupported()
91     {
92         return this.inputStream.markSupported();
93     }
94
95     /**
96      * @see ve.luz.ica.remoteio.RemoteInputStreamOperations#reset()
97      */

98     public void reset() throws RemoteIOException
99     {
100         try
101         {
102             this.inputStream.reset();
103         }
104         catch (IOException JavaDoc e)
105         {
106             throw new RemoteIOException(e.getMessage());
107         }
108     }
109
110     /**
111      * @see ve.luz.ica.remoteio.RemoteInputStreamOperations#skip(long)
112      */

113     public long skip(long n) throws RemoteIOException
114     {
115         try
116         {
117             return this.inputStream.skip(n);
118         }
119         catch (IOException JavaDoc e)
120         {
121             throw new RemoteIOException(e.getMessage());
122         }
123     }
124
125 }
126
Popular Tags