Java Code Examples for org.apache.hadoop.io.Text#readString()

The following examples show how to use org.apache.hadoop.io.Text#readString() . 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: TezHeartbeatRequest.java    From tez with Apache License 2.0 6 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  if (in.readBoolean()) {
    int eventsCount = in.readInt();
    events = new ArrayList<TezEvent>(eventsCount);
    for (int i = 0; i < eventsCount; ++i) {
      TezEvent e = new TezEvent();
      e.readFields(in);
      events.add(e);
    }
  }
  if (in.readBoolean()) {
    currentTaskAttemptID = TezTaskAttemptID.readTezTaskAttemptID(in);
  } else {
    currentTaskAttemptID = null;
  }
  startIndex = in.readInt();
  preRoutedStartIndex = in.readInt();
  maxEvents = in.readInt();
  requestId = in.readLong();
  containerIdentifier = Text.readString(in);
}
 
Example 2
Source File: SleepJob.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  id = WritableUtils.readVInt(in);
  sleepDuration = WritableUtils.readVLong(in);
  nMaps = WritableUtils.readVInt(in);
  nSpec = WritableUtils.readVInt(in);
  if (reduceDurations.length < nSpec) {
    reduceDurations = new long[nSpec];
  }
  for (int i = 0; i < nSpec; ++i) {
    reduceDurations[i] = WritableUtils.readVLong(in);
  }
  final int nLoc = WritableUtils.readVInt(in);
  if (nLoc != locations.length) {
    locations = new String[nLoc];
  }
  for (int i = 0; i < nLoc; ++i) {
    locations[i] = Text.readString(in);
  }
}
 
Example 3
Source File: RecoverTreeNode.java    From RDFS with Apache License 2.0 6 votes vote down vote up
public void readFields(DataInput in) throws IOException {
	hostName = Text.readString(in);
	if(in.readBoolean()) {
		element = new RecoverTreeNodeElement();
		element.readFields(in);
	}
	
	int childrenNumber = in.readInt();
	if(childrenNumber > 0) {
		children = new LinkedList<TreeNode>();
		for(int i = 0; i < childrenNumber; i++) {
			TreeNode child = new RecoverTreeNode();
			child.readFields(in);
			this.addChild(child);
		}
	}
	else {
		children = null;
	}
}
 
Example 4
Source File: BlocksWithLocations.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/** deserialization method */
public void readFields(DataInput in) throws IOException {
  block.readFields(in);
  int len = WritableUtils.readVInt(in); // variable length integer
  datanodeIDs = new String[len];
  for(int i=0; i<len; i++) {
    datanodeIDs[i] = Text.readString(in);
  }
}
 
Example 5
Source File: ReplaceBlockHeader.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  namespaceId = in.readInt();
  blockId = in.readLong();
  genStamp = in.readLong();
  sourceID = Text.readString(in);
  proxySource = new DatanodeInfo();
  proxySource.readFields(in);
}
 
Example 6
Source File: Content.java    From nutch-htmlunit with Apache License 2.0 5 votes vote down vote up
private final void readFieldsCompressed(DataInput in) throws IOException {
  byte oldVersion = in.readByte();
  switch (oldVersion) {
  case 0:
  case 1:
    url = Text.readString(in); // read url
    base = Text.readString(in); // read base

    content = new byte[in.readInt()]; // read content
    in.readFully(content);

    contentType = Text.readString(in); // read contentType
    // reconstruct metadata
    int keySize = in.readInt();
    String key;
    for (int i = 0; i < keySize; i++) {
      key = Text.readString(in);
      int valueSize = in.readInt();
      for (int j = 0; j < valueSize; j++) {
        metadata.add(key, Text.readString(in));
      }
    }
    break;
  case 2:
    url = Text.readString(in); // read url
    base = Text.readString(in); // read base

    content = new byte[in.readInt()]; // read content
    in.readFully(content);

    contentType = Text.readString(in); // read contentType
    metadata.readFields(in); // read meta data
    break;
  default:
    throw new VersionMismatchException((byte)2, oldVersion);
  }

}
 
Example 7
Source File: FileStatus.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  String strPath = Text.readString(in);
  this.path = new Path(strPath);
  this.length = in.readLong();
  this.isdir = in.readBoolean();
  this.block_replication = in.readShort();
  blocksize = in.readLong();
  modification_time = in.readLong();
  access_time = in.readLong();
  permission.readFields(in);
  owner = Text.readString(in);
  group = Text.readString(in);
}
 
Example 8
Source File: SSTableSplit.java    From hadoop-sstable with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    file = new Path(Text.readString(in));
    length = in.readLong();
    start = in.readLong();
    end = in.readLong();
    hosts = null;
}
 
Example 9
Source File: IncrementalBlockReport.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  super.readFields(in);
  delHintsMap = new long[in.readInt()];
  for (int i = 0; i < delHintsMap.length; i++) {
    delHintsMap[i] = in.readLong();
  }
  delHints = new String[in.readInt()];
  for (int i = 0; i < delHints.length; i++) {
    delHints[i] = Text.readString(in);
  }
  currentBlock = 0;
  currentHint = 0;
}
 
Example 10
Source File: Loops.java    From nutch-htmlunit with Apache License 2.0 5 votes vote down vote up
public void readFields(DataInput in)
  throws IOException {

  int numNodes = in.readInt();
  loopSet = new HashSet<String>();
  for (int i = 0; i < numNodes; i++) {
    String url = Text.readString(in);
    loopSet.add(url);
  }
}
 
Example 11
Source File: DataTransferPacket.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void read(DataInputStream in) throws IOException {
	readHeader(in);
	if (dataLength > 0) {
		try {
			IOUtils.readFully(in, buffer, 0, dataLength);
		} catch (ArrayIndexOutOfBoundsException e) {
			throw new ArrayIndexOutOfBoundsException("buffer.length = "
					+ buffer.length + ", dataLength = "
					+ dataLength);
		}
	} else if (dataLength < 0) {
		errMessage = Text.readString(in);
	}
}
 
Example 12
Source File: LargeBinaryDocument.java    From marklogic-contentpump with Apache License 2.0 5 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    path = new Path(Text.readString(in));
    offset = in.readLong();
    size = in.readLong();
    binaryOrigLen = in.readLong();
    conf = new Configuration();
    conf.readFields(in);
}
 
Example 13
Source File: AccessControlList.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * Deserializes the AccessControlList object
 */
@Override
public void readFields(DataInput in) throws IOException {
  String aclString = Text.readString(in);
  buildACL(aclString.split(" ", 2));
}
 
Example 14
Source File: OpenFileInfo.java    From RDFS with Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  filePath = Text.readString(in);
  millisOpen = in.readLong();
}
 
Example 15
Source File: MultiFileWordCount.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  this.offset = in.readLong();
  this.fileName = Text.readString(in);
}
 
Example 16
Source File: QueueAclsInfo.java    From RDFS with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
  queueName = Text.readString(in);
  operations = WritableUtils.readStringArray(in);
}
 
Example 17
Source File: DistTool.java    From hadoop with Apache License 2.0 4 votes vote down vote up
protected static String readString(DataInput in) throws IOException {
  if (in.readBoolean()) {
    return Text.readString(in);
  }
  return null;
}
 
Example 18
Source File: DataDrivenDBInputFormat.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
public void readFields(DataInput input) throws IOException {
  this.lowerBoundClause = Text.readString(input);
  this.upperBoundClause = Text.readString(input);
}
 
Example 19
Source File: JobSplit.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public void readFields(DataInput in) throws IOException {
  splitLocation = Text.readString(in);
  startOffset = WritableUtils.readVLong(in);
}
 
Example 20
Source File: DocumentURI.java    From marklogic-contentpump with Apache License 2.0 4 votes vote down vote up
@Override
public void readFields(DataInput in) throws IOException {
    uri = Text.readString(in);
}