Java Code Examples for org.apache.hadoop.conf.Configuration#write()

The following examples show how to use org.apache.hadoop.conf.Configuration#write() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HadoopConfSerializeWrapper.java    From twister2 with Apache License 2.0 5 votes vote down vote up
public HadoopConfSerializeWrapper(Configuration configuration) {
  this.configuration = configuration;

  try {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    configuration.write(new DataOutputStream(out));

    this.value = out.toByteArray();
  } catch (IOException e) {
    throw new RuntimeException("Failed to write hadoop configuration to byte array", e);
  }
}
 
Example 2
Source File: HadoopFormatIO.java    From beam with Apache License 2.0 4 votes vote down vote up
@Override
public void encode(Configuration value, OutputStream outStream) throws IOException {
  DataOutputStream dataOutputStream = new DataOutputStream(outStream);
  value.write(dataOutputStream);
  dataOutputStream.flush();
}