public void write()

in src/com/pty4j/windows/winpty/WinPTYOutputStream.java [29:53]


  public void write(byte[] b, int off, int len) throws IOException {
    if (b == null) {
      throw new NullPointerException();
    }
    if (off < 0 || len < 0 || len > b.length - off) {
      throw new IndexOutOfBoundsException();
    }

    if (myPatchNewline) {
      byte[] newBuf = new byte[len];
      int newPos = 0;
      for (int i = off; i < off + len; ++i) {
        if (b[i] == '\n') {
          newBuf[newPos++] = '\r';
        } else {
          newBuf[newPos++] = b[i];
        }
      }
      b = newBuf;
      off = 0;
      len = newPos;
    }

    myNamedPipe.write(b, off, len);
  }