home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / io / Writer.class (.txt) < prev   
Encoding:
Java Class File  |  1979-12-31  |  1020 b   |  65 lines

  1. package java.io;
  2.  
  3. public abstract class Writer {
  4.    private char[] writeBuffer;
  5.    private final int writeBufferSize = 1024;
  6.    protected Object lock;
  7.  
  8.    protected Writer() {
  9.       this.lock = this;
  10.    }
  11.  
  12.    protected Writer(Object var1) {
  13.       if (var1 == null) {
  14.          throw new NullPointerException();
  15.       } else {
  16.          this.lock = var1;
  17.       }
  18.    }
  19.  
  20.    public void write(int var1) throws IOException {
  21.       Object var2 = this.lock;
  22.       synchronized(var2) {
  23.          if (this.writeBuffer == null) {
  24.             this.writeBuffer = new char[1024];
  25.          }
  26.  
  27.          this.writeBuffer[0] = (char)var1;
  28.          this.write((char[])this.writeBuffer, 0, 1);
  29.       }
  30.    }
  31.  
  32.    public void write(char[] var1) throws IOException {
  33.       this.write((char[])var1, 0, var1.length);
  34.    }
  35.  
  36.    public abstract void write(char[] var1, int var2, int var3) throws IOException;
  37.  
  38.    public void write(String var1) throws IOException {
  39.       this.write((String)var1, 0, var1.length());
  40.    }
  41.  
  42.    public void write(String var1, int var2, int var3) throws IOException {
  43.       Object var4 = this.lock;
  44.       synchronized(var4) {
  45.          char[] var5;
  46.          if (var3 <= 1024) {
  47.             if (this.writeBuffer == null) {
  48.                this.writeBuffer = new char[1024];
  49.             }
  50.  
  51.             var5 = this.writeBuffer;
  52.          } else {
  53.             var5 = new char[var3];
  54.          }
  55.  
  56.          var1.getChars(var2, var2 + var3, var5, 0);
  57.          this.write((char[])var5, 0, var3);
  58.       }
  59.    }
  60.  
  61.    public abstract void flush() throws IOException;
  62.  
  63.    public abstract void close() throws IOException;
  64. }
  65.