home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 9 / IOPROG_9.ISO / contrib / iis4 / iis4_07.cab / WriteStream.java < prev    next >
Encoding:
Java Source  |  1997-09-05  |  1.6 KB  |  53 lines

  1. /**
  2.  * WriteStream: Using the framework to output binary data.
  3.  */
  4.  
  5. package IISSample;
  6.  
  7. import aspcomp.*;
  8. import com.ms.com.*;
  9.  
  10.  
  11. public class WriteStream 
  12. {
  13.  
  14.     static byte[] byteArray = {
  15.             (byte)'T', (byte)'h', (byte)'i', (byte)'s', (byte)' ', 
  16.             (byte)'b', (byte)'y', (byte)'t', (byte)'e', (byte)' ',
  17.             (byte)'a', (byte)'r', (byte)'r', (byte)'a', (byte)'y',
  18.             (byte)' ', (byte)'i', (byte)'s', (byte)' ', (byte)'b',
  19.             (byte)'e', (byte)'i', (byte)'n', (byte)'g', (byte)' ',
  20.             (byte)'w', (byte)'r', (byte)'i', (byte)'t', (byte)'t',
  21.             (byte)'e', (byte)'n', (byte)' ', (byte)'u',    (byte)'s',
  22.             (byte)'i', (byte)'n', (byte)'g', (byte)' ', (byte)'t',
  23.             (byte)'h', (byte)'e', (byte)' ', (byte)'<', (byte)'I',
  24.             (byte)'>', (byte)'r', (byte)'e', (byte)'s', (byte)'p',
  25.             (byte)'o', (byte)'n', (byte)'s', (byte)'e', (byte)'.',
  26.             (byte)'w', (byte)'r', (byte)'i', (byte)'t', (byte)'e',
  27.             (byte)'(', (byte)'b', (byte)'y', (byte)'t', (byte)'e',
  28.             (byte)'[', (byte)']', (byte)')', (byte)'<', (byte)'/',
  29.             (byte)'I', (byte)'>', (byte)' ', (byte)'m', (byte)'e',
  30.             (byte)'t', (byte)'h', (byte)'o', (byte)'d', (byte)' ',
  31.             (byte)'o', (byte)'f', (byte)' ', (byte)' ', (byte)'a',
  32.             (byte)' ', (byte)'s', (byte)'t', (byte)'r',    (byte)'e',
  33.             (byte)'a', (byte)'m', (byte)'.', (byte)'<', (byte)'P', 
  34.             (byte)'>'
  35.     };
  36.  
  37.     public void writeBytes() 
  38.     {
  39.         Response response = AspContext.getResponse();
  40.  
  41.         try 
  42.         {
  43.             response.write((byte[])byteArray);
  44.         } 
  45.         catch (Throwable e) 
  46.         {
  47.             response.write("<P>Error writing stream!<P>");
  48.         }
  49.  
  50.     }
  51.  
  52. }
  53.