コード例 #1
0
 @Override
 public void serialize(C[] value, DataOutputView target) throws IOException {
   target.writeInt(value.length);
   for (int i = 0; i < value.length; i++) {
     C val = value[i];
     if (val == null) {
       target.writeBoolean(false);
     } else {
       target.writeBoolean(true);
       componentSerializer.serialize(val, target);
     }
   }
 }
コード例 #2
0
ファイル: Path.java プロジェクト: ktzoumas/incubator-flink
  @Override
  public void write(DataOutputView out) throws IOException {

    if (uri == null) {
      out.writeBoolean(false);
    } else {
      out.writeBoolean(true);
      StringUtils.writeNullableString(uri.getScheme(), out);
      StringUtils.writeNullableString(uri.getUserInfo(), out);
      StringUtils.writeNullableString(uri.getHost(), out);
      out.writeInt(uri.getPort());
      StringUtils.writeNullableString(uri.getPath(), out);
      StringUtils.writeNullableString(uri.getQuery(), out);
      StringUtils.writeNullableString(uri.getFragment(), out);
    }
  }
コード例 #3
0
  @Override
  public void copy(DataInputView source, DataOutputView target) throws IOException {
    int len = source.readInt();
    target.writeInt(len);

    for (int i = 0; i < len; i++) {
      boolean isNonNull = source.readBoolean();
      target.writeBoolean(isNonNull);

      if (isNonNull) {
        componentSerializer.copy(source, target);
      }
    }
  }