1 package com.daffodilwoods.rmi.server; 2 3 import com.daffodilwoods.rmi.interfaces.*; 4 import com.daffodilwoods.database.resource.*; 5 import java.rmi.server.UnicastRemoteObject ; 6 import java.io.*; 7 import java.rmi.RemoteException ; 8 public class RmiInputStreamServerSide extends UnicastRemoteObject implements _RmiInputStream { 9 InputStream inputStream; 10 public RmiInputStreamServerSide(InputStream inputStream) throws RemoteException { 11 this.inputStream = inputStream; 12 } 13 14 public long skip(long n) throws IOException, RemoteException { 15 return inputStream.skip(n); 16 } 17 18 public int available() throws IOException, RemoteException { 19 return inputStream.available(); 20 } 21 22 public void close() throws IOException, RemoteException { 23 inputStream.close(); 24 } 25 26 public void mark(int readlimit) throws RemoteException { 27 inputStream.mark(readlimit); 28 } 29 30 public void reset() throws IOException, RemoteException { 31 inputStream.reset(); 32 } 33 34 public boolean markSupported() throws RemoteException { 35 return inputStream.markSupported(); 36 } 37 38 public byte[] getBytes(int off, int len) throws RemoteException { 39 try { 40 byte[] b = new byte[len]; 41 int i = inputStream.read(b,0,len); 42 if(i<0) 43 return null; 44 byte[] b1 = new byte[i]; 45 System.arraycopy(b,0,b1,0,i); 46 return b1; 47 48 } catch (java.io.IOException e ) { 49 throw new RemoteException (e.getMessage()); 50 } 51 } 52 } 53 | Popular Tags |