home *** CD-ROM | disk | FTP | other *** search
/ Java Developer's Companion / Java Developer's Companion.iso / Javacup / PR8ADPL7.TAR / productivity_tools / PR8ADPL7 / DeviceDriver.java < prev    next >
Encoding:
Java Source  |  1996-05-23  |  1.0 KB  |  31 lines

  1. // DeviceDriver
  2. // When the server sees a get or put request for a file with type
  3. // jfs/special, instead of calling the FileSystem to do something it
  4. // instead creates a device driver object from the class <file>Device, where
  5. // <file> is the name of the device file. All device driver classes must be
  6. // subclasses from this DeviceDriver class and should override one or
  7. // both of the read and write methods.
  8. import java.io.IOException;
  9. import Message;
  10.  
  11. public abstract class DeviceDriver
  12. {
  13.     // read
  14.     // Called when a get() request comes in for this device. Actual
  15.     // device drivers should override this to return some data read
  16.     // from the device, based on the given message.
  17.     Message read(Message msg, ServerClient s) throws IOException
  18.     {
  19.     throw new IOException("Cannot read from this device");
  20.     }
  21.  
  22.     // write
  23.     // Called when a put() request comes in for this device. This should
  24.     // do something based on the given message.
  25.     void write(Message msg, ServerClient s) throws IOException
  26.     {
  27.     throw new IOException("Cannot write to this device");
  28.     }
  29. }
  30.  
  31.