code: public DataOutputStream createDataOutputStream(FSDataOutputStream outputStream) throws IOException {
          if (codec != null) {
              return new FSDataOutputStream(codec.createOutputStream(outputStream), null);
          } else {
              return outputStream;
          }
      }
docs: Create a DataOutputStream from FSDataOutputStream. If the codec is available,
  it will create compressed DataOutputStream, otherwise, it will return itself.
  
  @param outputStream
  @return
  @throws java.io.IOException