This method reads a single byte from the input stream.

@param is the input stream
@return byte value
@throws IOException on file read error or EOF
973419
protected int readByte(InputStream is) throws IOException
   {
      byte[] data = new byte[1];
      if (is.read(data) != data.length)
      {
         throw new EOFException();
      }

      return (MPPUtility.getByte(data, 0));
   }
181263
@Override
  void readStreamBlob(InputStream is, 
                      byte[] buffer, int offset, RowCursor cursor)
    throws IOException
  {
    int len = BitsUtil.readInt(is);

    if (len == 0) {
      BitsUtil.writeInt(buffer, offset + offset(), 0);
      return;
    }
    
    try (BlobOutputStream blob = openOutputStream(cursor)) {
      while (len > 0) {
        boolean isNext = (len & BLOB_CONT_MASK) != 0;
        len &= ~BLOB_CONT_MASK;
        
        blob.writeFromStream(is, len);
        
        if (isNext) {
          len = BitsUtil.readInt(is);
        }
        else {
          len = 0;
        }
      }
    } catch (IOException e) {
      e.printStackTrace();
      
      throw e;
    }
    
    if (len < 0) {
      throw new IOException(L.l("Unexpected end of file while reading {0}", this));
    }

    //cursor.setBlob(getIndex(), blob);
  }
683495
byte []readBinary()
    throws IOException
  {
    TempOutputStream tos = new TempOutputStream();
    
    while (true) {
      int ch = read();
      int len;
    
      switch (ch) {
      default:
        _peek = ch;
        return tos.toByteArray();
      
      case 0x20: case 0x21: case 0x22: case 0x23:
      case 0x24: case 0x25: case 0x26: case 0x27:
      case 0x28: case 0x29: case 0x2a: case 0x2b:
      case 0x2c: case 0x2d: case 0x2e: case 0x2f:
        len = ch - 0x20;
        readBinary(tos, len);
        return tos.toByteArray();
      
      case 0x34: case 0x35: case 0x36: case 0x37:
        len = ((ch - 0x34) << 8) + read();
        readBinary(tos, len);
        return tos.toByteArray();
        
      case 'B':
        len = readShort();
        readBinary(tos, len);
        return tos.toByteArray();
        
      case 'A':
        len = readShort();
        readBinary(tos, len);
        break;
      }
    }
  }
1254869
protected int readInt(InputStream is) throws IOException
   {
      byte[] data = new byte[4];
      if (is.read(data) != data.length)
      {
         throw new EOFException();
      }

      return (MPPUtility.getInt(data, 0));
   }
762387
@Override
	public int read(byte[] b) throws IOException {
		int result = stream.read(b);
		update(result);
		return result;
	}
110684
public byte[] readBytes()
        throws IOException
    {
        int tag = is.read();

        if (tag == 'N')
            return null;

        if (tag != 'B')
            throw expect("bytes", tag);

        int b16 = is.read();
        int b8 = is.read();

        int len = (b16 << 8) + b8;

        ByteArrayOutputStream bos = new ByteArrayOutputStream();

        for (int i = 0; i < len; i++)
            bos.write(is.read());

        return bos.toByteArray();
    }
557178
@Override
	public int read(byte[] b, int off, int len) throws IOException {
		int numread = this.in.read(b, off, len);
		if (numread > 0) {
			this.inputBytesRead += numread;
		}
		return numread;
	}
125953
@Override
    public int read(byte[] out) throws IOException {
        int i, off = 0;
        while (off < out.length && (i = in.read(out, off, out.length - off)) > 0) {
            off += i;
        }
        return off;
    }
904871
protected int readByte(InputStream in, CRC32 crc) throws IOException {
        int b = in.read();
        if (b == -1) {
            throw new EOFException();
        }
        if (crc != null) {
            crc.update(b);
        }
        return b & 0xff;
    }
51393
public static final int getInt(InputStream is) throws IOException
   {
      byte[] data = new byte[4];
      is.read(data);
      return getInt(data, 0);
   }
1195323
public static Symm obtain(InputStream is) throws IOException {
	  ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  try {
		  base64url.decode(is, baos);
	  } catch (IOException e) {
		  // don't give clue
		  throw new IOException("Invalid Key");
	  }
	  byte[] bkey = baos.toByteArray();
	  if(bkey.length<0x88) { // 2048 bit key
		  throw new IOException("Invalid key");
	  }
	  return baseCrypt().obtain(bkey);
  }
943749
private byte[] receiveBytes(InputStream is) throws IOException {
        byte[] buffer = new byte[8192];
        int len = (is.read(buffer));
        if (len < 1) {
            throw new IOException("receiveBytes read " + len + " bytes.");
        }
        return Arrays.copyOf(buffer, len);
    }
936740
private void readVersion(InputStream is) throws IOException
   {
      BytesReadInputStream bytesReadStream = new BytesReadInputStream(is);
      String version = DatatypeConverter.getString(bytesReadStream);
      m_offset += bytesReadStream.getBytesRead();
      SynchroLogger.log("VERSION", version);
      
      String[] versionArray = version.split("\\.");
      m_majorVersion = Integer.parseInt(versionArray[0]);
   }
1042625
public static String getInputStreamAsString(InputStream is) throws IOException {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		ReadableByteChannel rbch = Channels.newChannel(is);
		WritableByteChannel wbch = Channels.newChannel(baos);
		fastChannelCopy(rbch, wbch);
		rbch.close();
		wbch.close();
		return new String(baos.toByteArray(), Charset.forName("UTF-8"));
	}
274734
public static String readStreamToString(InputStream is, String encoding) throws IOException {
		try {
			StringBuilder sb = new StringBuilder();
			byte[] buf = new byte[1024 * 10];
			int read;
			while ((read = is.read(buf)) >= 0) {
				sb.append(new String(buf, 0, read, encoding));
			}
			return sb.toString();
		} finally {
			is.close();
		}
	}
383131
public byte[] readBytes() throws IOException {
    int toRead = readInt();
    byte[] bytes = new byte[toRead];
    while (toRead > 0) {
      int byteRead = input.read(bytes, bytes.length - toRead, toRead);
      if (byteRead == -1) {
        throw new EOFException();
      }
      toRead -= byteRead;
    }
    return bytes;
  }
1083989
@Override
    public final int read(byte[] pBytes) throws IOException {
        return read(pBytes, 0, pBytes != null ? pBytes.length : 1);
    }