Java Code Examples for org.apache.hadoop.io.WritableUtils#writeStringArray()

The following examples show how to use org.apache.hadoop.io.WritableUtils#writeStringArray() . 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: TaskReport.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public void write(DataOutput out) throws IOException {
  taskid.write(out);
  out.writeFloat(progress);
  Text.writeString(out, state);
  out.writeLong(startTime);
  out.writeLong(finishTime);
  WritableUtils.writeStringArray(out, diagnostics);
  counters.write(out);
  WritableUtils.writeEnum(out, currentStatus);
  if (currentStatus == TIPStatus.RUNNING) {
    WritableUtils.writeVInt(out, runningAttempts.size());
    TaskAttemptID t[] = new TaskAttemptID[0];
    t = runningAttempts.toArray(t);
    for (int i = 0; i < t.length; i++) {
      t[i].write(out);
    }
  } else if (currentStatus == TIPStatus.COMPLETE) {
    successfulAttempt.write(out);
  }
}
 
Example 2
Source File: ForestDocument.java    From marklogic-contentpump with Apache License 2.0 6 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
    out.writeLong(fragmentOrdinal);
    WritableUtils.writeStringArray(out, collections);
    if (metadata == null || metadata.isEmpty()) {
        out.writeInt(0);
    } else {
        out.writeInt(metadata.size());
        String[] metaStrings = new String[metadata.size() * 2];
        int i = 0;
        for (Entry<String, String> entry : metadata.entrySet()) {
            metaStrings[i++] = entry.getKey();
            metaStrings[i++] = entry.getValue();
        }
        WritableUtils.writeStringArray(out, metaStrings);
    }
    out.writeInt(quality);
}
 
Example 3
Source File: TaskReport.java    From big-c with Apache License 2.0 6 votes vote down vote up
public void write(DataOutput out) throws IOException {
  taskid.write(out);
  out.writeFloat(progress);
  Text.writeString(out, state);
  out.writeLong(startTime);
  out.writeLong(finishTime);
  WritableUtils.writeStringArray(out, diagnostics);
  counters.write(out);
  WritableUtils.writeEnum(out, currentStatus);
  if (currentStatus == TIPStatus.RUNNING) {
    WritableUtils.writeVInt(out, runningAttempts.size());
    TaskAttemptID t[] = new TaskAttemptID[0];
    t = runningAttempts.toArray(t);
    for (int i = 0; i < t.length; i++) {
      t[i].write(out);
    }
  } else if (currentStatus == TIPStatus.COMPLETE) {
    successfulAttempt.write(out);
  }
}
 
Example 4
Source File: TaskReport.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public void write(DataOutput out) throws IOException {
  taskid.write(out);
  out.writeFloat(progress);
  Text.writeString(out, state);
  out.writeLong(startTime);
  out.writeLong(finishTime);
  WritableUtils.writeStringArray(out, diagnostics);
  counters.write(out);
  WritableUtils.writeEnum(out, currentStatus);
  if (currentStatus == TIPStatus.RUNNING) {
    WritableUtils.writeVInt(out, runningAttempts.size());
    TaskAttemptID t[] = new TaskAttemptID[0];
    t = runningAttempts.toArray(t);
    for (int i = 0; i < t.length; i++) {
      t[i].write(out);
    }
  } else if (currentStatus == TIPStatus.COMPLETE) {
    successfulAttempt.write(out);
  }
}
 
Example 5
Source File: TaskReport.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
public void write(DataOutput out) throws IOException {
  taskid.write(out);
  out.writeFloat(progress);
  Text.writeString(out, state);
  out.writeLong(startTime);
  out.writeLong(finishTime);
  out.writeBoolean(runOnGPU);
  WritableUtils.writeStringArray(out, diagnostics);
  counters.write(out);
  WritableUtils.writeEnum(out, currentStatus);
  if (currentStatus == TIPStatus.RUNNING) {
    WritableUtils.writeVInt(out, runningAttempts.size());
    TaskAttemptID t[] = new TaskAttemptID[0];
    t = runningAttempts.toArray(t);
    for (int i = 0; i < t.length; i++) {
      t[i].write(out);
    }
  } else if (currentStatus == TIPStatus.COMPLETE) {
    successfulAttempt.write(out);
  }
}
 
Example 6
Source File: TokenStore.java    From envelope with Apache License 2.0 5 votes vote down vote up
/**
 * Write the token aliases and {@link Credentials} to a Hadoop FileSystem.
 * @param file path of the file to be written
 * @param conf a Hadoop {@link} Configuration for the Hadoop FileSystem
 * @throws IOException if file cannot be written
 */
public void write(String file, Configuration conf) throws IOException {
  Path outFile = new Path(file);
  try (FSDataOutputStream fos = outFile.getFileSystem(conf).create(outFile)) {
    WritableUtils.writeStringArray(fos, tokenAliases.toArray(new String[]{}));
    credentials.writeTokenStorageToStream(fos);
  }
  outFile.getFileSystem(conf).setPermission(outFile,
      new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE));
  // Write the ready file
  outFile.getFileSystem(conf).create(new Path(file + ".READY")).close();
}
 
Example 7
Source File: ProtocolStatus.java    From anthelion with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput out) throws IOException {
  out.writeByte(VERSION);
  out.writeByte((byte)code);
  out.writeLong(lastModified);
  if (args == null) {
    out.writeInt(-1);
  } else {
    WritableUtils.writeStringArray(out, args);
  }
}
 
Example 8
Source File: ParseStatus.java    From anthelion with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput out) throws IOException {
  out.writeByte(VERSION);
  out.writeByte(majorCode);
  out.writeShort(minorCode);
  if (args == null) {
    out.writeInt(-1);
  } else {
    WritableUtils.writeStringArray(out, args);
  }
}
 
Example 9
Source File: ProtocolStatus.java    From nutch-htmlunit with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput out) throws IOException {
  out.writeByte(VERSION);
  out.writeByte((byte)code);
  out.writeLong(lastModified);
  if (args == null) {
    out.writeInt(-1);
  } else {
    WritableUtils.writeStringArray(out, args);
  }
}
 
Example 10
Source File: ParseStatus.java    From nutch-htmlunit with Apache License 2.0 5 votes vote down vote up
public void write(DataOutput out) throws IOException {
  out.writeByte(VERSION);
  out.writeByte(majorCode);
  out.writeShort(minorCode);
  if (args == null) {
    out.writeInt(-1);
  } else {
    WritableUtils.writeStringArray(out, args);
  }
}
 
Example 11
Source File: AegSplit.java    From aegisthus with Apache License 2.0 5 votes vote down vote up
@Override
public void write(@Nonnull DataOutput out) throws IOException {
    out.writeLong(end);
    WritableUtils.writeStringArray(out, hosts);
    WritableUtils.writeString(out, path.toUri().toString());
    out.writeLong(start);
}
 
Example 12
Source File: QueueAclsInfo.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  Text.writeString(out, queueName);
  WritableUtils.writeStringArray(out, operations);
}
 
Example 13
Source File: QueueAclsInfo.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  Text.writeString(out, queueName);
  WritableUtils.writeStringArray(out, operations);
}
 
Example 14
Source File: QueueAclsInfo.java    From RDFS with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  Text.writeString(out, queueName);
  WritableUtils.writeStringArray(out, operations);
}