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

The following examples show how to use org.apache.hadoop.conf.Configuration#write() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
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 Project: beam   File: HadoopFormatIO.java    License: 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();
}