docs: public int read(char ch[], int offset, int length) throws IOException {
          int byteLength = length << ((fEncoding >= 4)?2:1);
          if (byteLength > fBuffer.length) {
              byteLength = fBuffer.length;
          }
          int count = fInputStream.read(fBuffer, 0, byteLength);
          if(count == -1) return -1;
          // try and make count be a multiple of the number of bytes we're looking for
          if(fEncoding >= 4) { // BigEndian
              // this looks ugly, but it avoids an if at any rate...
              int numToRead = (4 - (count & 3) & 3);
              for(int i=0; i<numToRead; i++) {
                  int charRead = fInputStream.read();
                  if(charRead == -1) { // end of input; something likely went wrong!A  Pad buffer with nulls.
                      for (int j = i;j<numToRead; j++)
                          fBuffer[count+j] = 0;
                      break;
                  } else {
                      fBuffer[count+i] = (byte)charRead; 
                  }
              }
              count += numToRead;
          } else {
              int numToRead = count & 1;
              if(numToRead != 0) {
                  count++;
                  int charRead = fInputStream.read();
                  if(charRead == -1) { // end of input; something likely went wrong!A  Pad buffer with nulls.
                      fBuffer[count] = 0;
                  } else {
                      fBuffer[count] = (byte)charRead;
                  }
              }
          }
  
          // now count is a multiple of the right number of bytes
          int numChars = count >> ((fEncoding >= 4)?2:1);
          int curPos = 0;
          for (int i = 0; i < numChars; i++) {
              int b0 = fBuffer[curPos++] & 0xff;
              int b1 = fBuffer[curPos++] & 0xff;
              if(fEncoding >=4) {
                  int b2 = fBuffer[curPos++] & 0xff;
                  int b3 = fBuffer[curPos++] & 0xff;
                  if (fEncoding == UCS4BE)
                      ch[offset+i] = (char)((b0<<24)+(b1<<16)+(b2<<8)+b3);
                  else
                      ch[offset+i] = (char)((b3<<24)+(b2<<16)+(b1<<8)+b0);
              } else { // UCS-2
                  if (fEncoding == UCS2BE)
                      ch[offset+i] = (char)((b0<<8)+b1);
                  else
                      ch[offset+i] = (char)((b1<<8)+b0);
              }
          }
          return numChars;
      }