code: public void write(int datum) throws IOException {
          if (closed) {
              throw new IOException("Stream closed");
          } else {
              if (index == blockSize) {
                  addBuffer();
              }
  
              // store the byte
              buffer[index++] = (byte) datum;
          }
      }
docs: OutputStream overrides ----------------------------------------