Example usage for org.apache.hadoop.io Text readString

List of usage examples for org.apache.hadoop.io Text readString

Introduction

In this page you can find the example usage for org.apache.hadoop.io Text readString.

Prototype

public static String readString(DataInput in) throws IOException 

Source Link

Document

Read a UTF8 encoded string from in

Usage

From source file:com.blm.orc.OrcNewSplit.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    //deserialize path, offset, length using FileSplit
    super.readFields(in);

    byte flags = in.readByte();
    hasFooter = (OrcSplit.FOOTER_FLAG & flags) != 0;
    isOriginal = (OrcSplit.ORIGINAL_FLAG & flags) != 0;
    hasBase = (OrcSplit.BASE_FLAG & flags) != 0;

    deltas.clear();/*w w  w .j a va2s . co  m*/
    int numDeltas = in.readInt();
    for (int i = 0; i < numDeltas; i++) {
        deltas.add(in.readLong());
    }
    if (hasFooter) {
        // deserialize FileMetaInfo fields
        String compressionType = Text.readString(in);
        int bufferSize = WritableUtils.readVInt(in);
        int metadataSize = WritableUtils.readVInt(in);

        // deserialize FileMetaInfo field footer
        int footerBuffSize = WritableUtils.readVInt(in);
        ByteBuffer footerBuff = ByteBuffer.allocate(footerBuffSize);
        in.readFully(footerBuff.array(), 0, footerBuffSize);
        OrcFile.WriterVersion writerVersion = ReaderImpl.getWriterVersion(WritableUtils.readVInt(in));

        fileMetaInfo = new ReaderImpl.FileMetaInfo(compressionType, bufferSize, metadataSize, footerBuff,
                writerVersion);
    }
}

From source file:com.blm.orc.OrcSplit.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    //deserialize path, offset, length using FileSplit
    super.readFields(in);

    byte flags = in.readByte();
    hasFooter = (FOOTER_FLAG & flags) != 0;
    isOriginal = (ORIGINAL_FLAG & flags) != 0;
    hasBase = (BASE_FLAG & flags) != 0;

    deltas.clear();//from w  ww  .java 2 s.c  o  m
    int numDeltas = in.readInt();
    for (int i = 0; i < numDeltas; i++) {
        deltas.add(in.readLong());
    }
    if (hasFooter) {
        // deserialize FileMetaInfo fields
        String compressionType = Text.readString(in);
        int bufferSize = WritableUtils.readVInt(in);
        int metadataSize = WritableUtils.readVInt(in);

        // deserialize FileMetaInfo field footer
        int footerBuffSize = WritableUtils.readVInt(in);
        ByteBuffer footerBuff = ByteBuffer.allocate(footerBuffSize);
        in.readFully(footerBuff.array(), 0, footerBuffSize);
        OrcFile.WriterVersion writerVersion = ReaderImpl.getWriterVersion(WritableUtils.readVInt(in));

        fileMetaInfo = new ReaderImpl.FileMetaInfo(compressionType, bufferSize, metadataSize, footerBuff,
                writerVersion);
    }
}

From source file:com.chinamobile.bcbsp.action.KillJobAction.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    jobId = Text.readString(in);
}

From source file:com.chinamobile.bcbsp.bspcontroller.Counters.java

License:Apache License

@Override
public synchronized void readFields(DataInput in) throws IOException {
    int numClasses = in.readInt();
    counters.clear();/*from  w w w. j a  v a 2s .  c  o m*/
    while (numClasses-- > 0) {
        String groupName = Text.readString(in);
        Group group = new Group(groupName);
        group.readFields(in);
        counters.put(groupName, group);
    }
}

From source file:com.chinamobile.bcbsp.bspstaff.BSPStaff.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    rawSplitClass = Text.readString(in);
    rawSplit.readFields(in);/*from   ww  w  .ja va2s . co  m*/
}

From source file:com.chinamobile.bcbsp.bspstaff.Staff.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    getJobId().readFields(in);/* w w  w.  j  av  a  2 s .  co  m*/
    jobFile = Text.readString(in);
    sid.readFields(in);
    partition = in.readInt();
    this.failCounter = in.readInt();
    jobExeLocalPath = Text.readString(in);
}

From source file:com.chinamobile.bcbsp.examples.StringEdge.java

License:Apache License

/**
 * Deserialize vertexID and edgeValue.// ww w.  j av  a 2 s . co  m
 * @param in vertexID or edgeValue
 */
@Override
public void readFields(DataInput in) throws IOException {
    this.vertexID = Text.readString(in);
    this.edgeValue = Text.readString(in);
}

From source file:com.chinamobile.bcbsp.examples.StringVertex.java

License:Apache License

/**
 * Deserialize vertexID and edgeValue,edgesList
 * @param in//from   w w w  .j  a v a  2  s  . c o m
 *        vertexID or edgeValue
 */
@Override
public void readFields(DataInput in) throws IOException {
    this.vertexID = Text.readString(in);
    this.vertexValue = Text.readString(in);
    this.edgesList.clear();
    int numEdges = in.readInt();
    StringEdge edge;
    for (int i = 0; i < numEdges; i++) {
        edge = new StringEdge();
        edge.readFields(in);
        this.edgesList.add(edge);
    }
}

From source file:com.chinamobile.bcbsp.fault.storage.Fault.java

License:Apache License

/**
 * read fault information.//ww  w.j  a  v a 2s. c o m
 * @param in
 *        fault information to be read.
 */
@Override
public void readFields(DataInput in) throws IOException {
    this.type = WritableUtils.readEnum(in, Type.class);
    this.level = WritableUtils.readEnum(in, Level.class);
    this.timeOfFailure = Text.readString(in);
    this.workerNodeName = Text.readString(in);
    this.jobName = Text.readString(in);
    this.staffName = Text.readString(in);
    this.exceptionMessage = Text.readString(in);
    this.superStep_Stage = in.readInt();
}

From source file:com.chinamobile.bcbsp.sync.SuperStepCommand.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    this.commandType = in.readInt();
    this.initWritePath = Text.readString(in);
    this.initReadPath = Text.readString(in);
    this.ableCheckPoint = in.readInt();
    this.nextSuperStepNum = in.readInt();
    this.oldCheckPoint = in.readInt();
    int count = in.readInt();
    this.aggValues = new String[count];
    for (int i = 0; i < count; i++) {
        this.aggValues[i] = Text.readString(in);
    }//w  ww.j av a 2  s  .  c om
    int size = WritableUtils.readVInt(in);
    if (size > 0) {
        String[] partitionToWMName = WritableUtils.readCompressedStringArray(in);
        this.partitionToWorkerManagerNameAndPort = new HashMap<Integer, String>();
        for (int j = 0; j < size; j++) {
            this.partitionToWorkerManagerNameAndPort.put(j, partitionToWMName[j]);
        }
    }
    this.migrateStaffIDs = in.readUTF();
    this.migrateVertexCommand.readFields(in);

}