code: protected int readWord(InputStream inputStream) throws IOException {
          byte[] bytes = new byte[2];
          boolean success = inputStream.read(bytes) == 2;
          return !success ? -1 : readWord(bytes, 0);
      }
docs: Reads a two-byte integer from the input stream.
  
  @param inputStream The input stream.
  @return A two-byte integer value.
  @throws IOException Exception while reading from input stream.