@Override
  public void read(DataInputView in) throws IOException {

    final int addr_length = in.readInt();
    byte[] address = new byte[addr_length];
    in.readFully(address);

    this.dataPort = in.readInt();

    this.fqdnHostName = StringUtils.readNullableString(in);
    this.hostName = StringUtils.readNullableString(in);

    try {
      this.inetAddress = InetAddress.getByAddress(address);
    } catch (UnknownHostException e) {
      throw new IOException("This lookup should never fail.", e);
    }
  }
Exemplo n.º 2
0
  @Override
  public void read(DataInputView in) throws IOException {

    final boolean isNotNull = in.readBoolean();
    if (isNotNull) {
      final String scheme = StringUtils.readNullableString(in);
      final String userInfo = StringUtils.readNullableString(in);
      final String host = StringUtils.readNullableString(in);
      final int port = in.readInt();
      final String path = StringUtils.readNullableString(in);
      final String query = StringUtils.readNullableString(in);
      final String fragment = StringUtils.readNullableString(in);

      try {
        uri = new URI(scheme, userInfo, host, port, path, query, fragment);
      } catch (URISyntaxException e) {
        throw new IOException("Error reconstructing URI", e);
      }
    }
  }