/**
  * Reads <i>length</i> bytes from the pipe and puts them into the <i>buff</i> array starting from
  * position <i>offset</i>.
  */
 public synchronized int read(byte[] buff, int offset, int length) {
   int available = length();
   if (available >= length) return super.read(buff, offset, length);
   // else
   super.read(buff, offset, available);
   int diff = length - available;
   for (int i = 0; i < diff; i++) buff[offset + available + i] = 0;
   return length;
 }