Example usage for java.io DataInput readLong

List of usage examples for java.io DataInput readLong

Introduction

In this page you can find the example usage for java.io DataInput readLong.

Prototype

long readLong() throws IOException;

Source Link

Document

Reads eight input bytes and returns a long value.

Usage

From source file:com.liveramp.cascading_ext.bloom.BloomFilter.java

@Override
public void readFields(DataInput in) throws IOException {
    numHashes = in.readInt();//www.jav a  2 s  . com
    vectorSize = in.readLong();
    numElems = in.readLong();
    byte[] bytes = new byte[FixedSizeBitSet.getNumBytesToStore(vectorSize)];
    in.readFully(bytes);
    bits = new FixedSizeBitSet(vectorSize, bytes);
    byte[] serializedHashFunction = new byte[in.readInt()];
    in.readFully(serializedHashFunction);
    hashFunction = (HashFunction) SerializationUtils.deserialize(serializedHashFunction);
}

From source file:com.marklogic.mapreduce.LargeBinaryDocument.java

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    path = new Path(Text.readString(in));
    offset = in.readLong();
    size = in.readLong();//from  w ww.  j av a 2  s.  c  om
    binaryOrigLen = in.readLong();
    conf = new Configuration();
    conf.readFields(in);
}

From source file:com.nearinfinity.blur.mapreduce.BlurTask.java

@Override
public void readFields(DataInput input) throws IOException {
    _maxRecordCount = input.readLong();
    _ramBufferSizeMB = input.readInt();//from  www .  ja  v a2 s.co m
    _optimize = input.readBoolean();
    _indexingType = INDEXING_TYPE.valueOf(readString(input));
    byte[] data = new byte[input.readInt()];
    input.readFully(data);
    ByteArrayInputStream is = new ByteArrayInputStream(data);
    TIOStreamTransport trans = new TIOStreamTransport(is);
    TBinaryProtocol protocol = new TBinaryProtocol(trans);
    _tableDescriptor = new TableDescriptor();
    try {
        _tableDescriptor.read(protocol);
    } catch (TException e) {
        throw new IOException(e);
    }
}

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

@Override
public void readFields(DataInput in) throws IOException {
    this.faultSSStep = in.readInt();
    this.timestamp = in.readLong();
    int t = in.readInt();
    if (Directive.Type.Request.value() == t) {
        this.type = Directive.Type.Request;
        int length = WritableUtils.readVInt(in);
        if (length > 0) {
            this.actionList = new ArrayList<WorkerManagerAction>();
            for (int i = 0; i < length; ++i) {
                WorkerManagerAction.ActionType actionType = WritableUtils.readEnum(in,
                        WorkerManagerAction.ActionType.class);
                WorkerManagerAction action = WorkerManagerAction.createAction(actionType);
                action.readFields(in);//from w w w.  j a  va  2  s. c o m
                this.actionList.add(action);
            }
        } else {
            this.actionList = null;
        }

        this.workerManagersName = WritableUtils.readCompressedStringArray(in);
    } else if (Directive.Type.Response.value() == t) {
        this.type = Directive.Type.Response;
        this.status = new WorkerManagerStatus();
        this.status.readFields(in);
    } else {
        throw new IllegalStateException("Wrong directive type:" + t);
    }

    /* Zhicheng Liu added */
    this.migrateSSStep = in.readInt();

}

From source file:com.flipkart.fdp.migration.distcp.config.ConnectionConfig.java

@Override
public void readFields(DataInput in) throws IOException {
    userName = Text.readString(in);
    userPassword = Text.readString(in);
    keyFile = Text.readString(in);
    connectionURL = Text.readString(in);
    securityType = SecurityType.valueOf(Text.readString(in));
    freeSpaceInBytes = in.readLong();
    path = Text.readString(in);/*from  w w w  . ja v  a2  s  . c o  m*/

}

From source file:io.dstream.hadoop.TypeAwareWritable.java

/**
 * //from   w w  w  .j  a v  a  2 s  . c o m
 */
@Override
public void readFields(DataInput in) throws IOException {
    this.valueType = in.readByte();
    switch (this.valueType) {
    case INTEGER:
        this.value = (T) Integer.valueOf(in.readInt());
        break;
    case LONG:
        this.value = (T) Long.valueOf(in.readLong());
        break;
    case NULL:
        this.value = null;
        break;
    case OBJECT:
        try {
            ObjectInputStream ois = new ObjectInputStream((DataInputStream) in);
            T value = (T) ois.readObject();
            this.value = (T) value;
        } catch (Exception e) {
            throw new IllegalStateException("Failed to deserialize value", e);
        }
        break;
    default:
        throw new IllegalStateException("Unsupported or unrecognized value type: " + this.valueType);
    }
}

From source file:io.dstream.tez.io.TypeAwareWritable.java

/**
 *
 *///from w  w w . ja  v  a 2  s  .  c om
@Override
public void readFields(DataInput in) throws IOException {
    this.valueType = in.readByte();
    switch (this.valueType) {
    case INTEGER:
        this.value = (T) Integer.valueOf(in.readInt());
        break;
    case LONG:
        this.value = (T) Long.valueOf(in.readLong());
        break;
    case NULL:
        this.value = null;
        break;
    case OBJECT:
        try {
            ObjectInputStream ois = new ObjectInputStream((DataInputStream) in);
            T value = (T) ois.readObject();
            this.value = value;
        } catch (Exception e) {
            throw new IllegalStateException("Failed to deserialize value", e);
        }
        break;
    default:
        throw new IllegalStateException("Unsupported or unrecognized value type: " + this.valueType);
    }
}

From source file:com.chinamobile.bcbsp.util.JobStatus.java

/**
 * deserialize/*ww w  . j ava  2s  . c o  m*/
 *
 * @param in Reads some bytes from an input.
 */
@Override
public synchronized void readFields(DataInput in) throws IOException {
    this.jobid = new BSPJobID();
    jobid.readFields(in);
    this.setupProgress = in.readLong();
    this.progress = in.readLong();
    this.cleanupProgress = in.readLong();
    this.runState = in.readInt();
    this.state = WritableUtils.readEnum(in, State.class);
    this.startTime = in.readLong();
    this.finishTime = in.readLong();
    this.user = Text.readString(in);
    //    this.schedulingInfo = Text.readString(in);
    this.superstepCount = in.readLong();
    this.recovery = in.readBoolean();
}

From source file:edu.umn.cs.spatialHadoop.nasa.HDFRasterLayer.java

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    this.timestamp = in.readLong();
    int length = in.readInt();
    byte[] serializedData = new byte[length];
    in.readFully(serializedData);// w w w. ja  v a 2 s  .co  m
    ByteArrayInputStream bais = new ByteArrayInputStream(serializedData);
    GZIPInputStream gzis = new GZIPInputStream(bais);

    byte[] buffer = new byte[8];
    gzis.read(buffer);
    ByteBuffer bbuffer = ByteBuffer.wrap(buffer);
    int width = bbuffer.getInt();
    int height = bbuffer.getInt();
    // Reallocate memory only if needed
    if (width != this.getWidth() || height != this.getHeight()) {
        sum = new long[width][height];
        count = new long[width][height];
    }
    buffer = new byte[getHeight() * 2 * 8];
    for (int x = 0; x < getWidth(); x++) {
        int size = 0;
        while (size < buffer.length) {
            size += gzis.read(buffer, size, buffer.length - size);
        }
        bbuffer = ByteBuffer.wrap(buffer);
        for (int y = 0; y < getHeight(); y++) {
            sum[x][y] = bbuffer.getLong();
            count[x][y] = bbuffer.getLong();
        }
    }
}

From source file:com.mobicage.rogerthat.registration.ContentBrandingRegistrationWizard.java

@Override
public void readFromPickle(int version, DataInput in) throws IOException, PickleException {
    T.UI();//  ww w . j  a v  a2  s  .c o  m
    boolean set = in.readBoolean();
    if (set)
        mCredentials = new Credentials(new Pickle(in.readInt(), in));
    set = in.readBoolean();
    mEmail = set ? in.readUTF() : null;
    mTimestamp = in.readLong();
    mRegistrationId = in.readUTF();
    mInstallationId = in.readUTF();
    mDeviceId = in.readUTF();
}