Example usage for java.io DataInput readBoolean

List of usage examples for java.io DataInput readBoolean

Introduction

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

Prototype

boolean readBoolean() throws IOException;

Source Link

Document

Reads one input byte and returns true if that byte is nonzero, false if that byte is zero.

Usage

From source file:com.netflix.aegisthus.input.AegSplit.java

@Override
public void readFields(DataInput in) throws IOException {
    end = in.readLong();/*from   w  w  w.jav  a2  s .  c om*/
    hosts = WritableUtils.readStringArray(in);
    path = new Path(WritableUtils.readString(in));
    compressed = in.readBoolean();
    if (compressed) {
        compressedPath = new Path(WritableUtils.readString(in));
    }
    start = in.readLong();
    type = WritableUtils.readEnum(in, Type.class);
    int size = in.readInt();
    if (type == Type.sstable) {
        convertors = Maps.newHashMap();
        for (int i = 0; i < size; i++) {
            String[] parts = WritableUtils.readStringArray(in);
            try {
                convertors.put(parts[0], TypeParser.parse(parts[1]));
            } catch (ConfigurationException e) {
                throw new IOException(e);
            } catch (SyntaxException e) {
                throw new IOException(e);
            }
        }
    }
}

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

@Override
public void readFields(DataInput input) throws IOException {
    _maxRecordCount = input.readLong();/*from w w  w . java2 s.  c o m*/
    _ramBufferSizeMB = input.readInt();
    _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.cg.mapreduce.fpgrowth.mahout.fpm.TransactionTree.java

@Override
public void readFields(DataInput in) throws IOException {
    representedAsList = in.readBoolean();

    VIntWritable vInt = new VIntWritable();
    VLongWritable vLong = new VLongWritable();

    if (representedAsList) {
        transactionSet = Lists.newArrayList();
        vInt.readFields(in);// w ww  .j  a v  a 2s  .co  m
        int numTransactions = vInt.get();
        for (int i = 0; i < numTransactions; i++) {
            vLong.readFields(in);
            Long support = vLong.get();

            vInt.readFields(in);
            int length = vInt.get();

            int[] items = new int[length];
            for (int j = 0; j < length; j++) {
                vInt.readFields(in);
                items[j] = vInt.get();
            }
            Pair<IntArrayList, Long> transaction = new Pair<IntArrayList, Long>(new IntArrayList(items),
                    support);
            transactionSet.add(transaction);
        }
    } else {
        vInt.readFields(in);
        nodes = vInt.get();
        attribute = new int[nodes];
        nodeCount = new long[nodes];
        childCount = new int[nodes];
        nodeChildren = new int[nodes][];
        for (int i = 0; i < nodes; i++) {
            vInt.readFields(in);
            attribute[i] = vInt.get();
            vLong.readFields(in);
            nodeCount[i] = vLong.get();
            vInt.readFields(in);
            int childCountI = vInt.get();
            childCount[i] = childCountI;
            nodeChildren[i] = new int[childCountI];
            for (int j = 0; j < childCountI; j++) {
                vInt.readFields(in);
                nodeChildren[i][j] = vInt.get();
            }
        }
    }
}

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

@SuppressWarnings("unchecked")
@Override/*from   ww w  . ja  v a 2  s. c o  m*/
public void readFromPickle(int version, DataInput in) throws IOException, PickleException {
    T.UI();
    super.readFromPickle(version, in);
    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();
    mInGoogleAuthenticationProcess = in.readBoolean();
    mInstallationId = in.readUTF();
    // A version bump was forgotten when serializing mDeviceId, so we need a try/catch
    try {
        mDeviceId = in.readUTF();
    } catch (EOFException e) {
        mDeviceId = null;
    }
    if (version >= 2) {
        try {
            set = in.readBoolean();
            mBeaconRegions = set
                    ? new GetBeaconRegionsResponseTO((Map<String, Object>) JSONValue.parse(in.readUTF()))
                    : null;

            set = in.readBoolean();
            if (set) {
                String detectedBeacons = in.readUTF();
                JSONArray db1 = (JSONArray) JSONValue.parse(detectedBeacons);
                if (db1 != null) {
                    mDetectedBeacons = new HashSet<String>();
                    for (int i = 0; i < db1.size(); i++) {
                        mDetectedBeacons.add((String) db1.get(i));
                    }
                } else {
                    mDetectedBeacons = null;
                }
            } else {
                mDetectedBeacons = null;
            }
        } catch (IncompleteMessageException e) {
            L.bug(e);
        }
    }
}

From source file:com.fiorano.openesb.application.aps.InPortInst.java

/**
 *  This is called to read this object <code>InPortInst</code> from the
 *  specified object of input stream.//from   w w  w  . j a v a2s  .  co m
 *
 * @param is DataInput object
 * @param versionNo Description of the Parameter
 * @exception IOException if an error occurs while reading bytes or while
 *      converting them into specified Java primitive type.
 * @since Tifosi2.0
 */
public void fromStream(DataInput is, int versionNo) throws IOException {
    super.fromStream(is, versionNo);

    m_strPortName = readUTF(is);
    m_strDscription = readUTF(is);
    m_strXSD = readUTF(is);
    m_strJavaClass = readUTF(is);
    m_bIsSyncRequestType = is.readBoolean();
    m_bisDisabled = is.readBoolean();

    int size = is.readInt();

    for (int i = 0; i < size; ++i) {
        Param param = new Param();

        param.fromStream(is, versionNo);
        m_params.addElement(param);
    }
}

From source file:FormatStorage1.IRecord.java

@Override
public void readFields(DataInput in) throws IOException {
    this.oldformat = in.readBoolean();
    this.fieldnum = in.readInt();
    HashMap<Integer, IFType> fts = new HashMap<Integer, IFType>(fieldnum);
    for (int i = 0; i < fieldnum; i++) {
        IFType ift = new IFType();
        ift.readFields(in);// www .j  a  v a2s .c  o  m
        fts.put(ift.idx, ift);
    }
    this.setFieldTypes(fts);
    this.readfieldTypes = this.fieldTypes;

    this.unpersistent(in);
}

From source file:com.mapr.hbase.support.objects.MHRegionInfo090x.java

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    this.endKey = Bytes.readByteArray(in);
    this.offLine = in.readBoolean();
    this.regionId = in.readLong();
    this.regionName = Bytes.readByteArray(in);
    this.regionNameStr = Bytes.toStringBinary(this.regionName);
    this.split = in.readBoolean();
    this.startKey = Bytes.readByteArray(in);
    try {/*from  www  .j  a v  a2s .  c o m*/
        this.tableDesc.readFields(in);
    } catch (EOFException eofe) {
        throw new IOException("HTD not found in input buffer");
    }
    this.hashCode = in.readInt();
}

From source file:cn.edu.xidian.repace.xml2hbase.filter.TestFilter.java

public void readFields(final DataInput in) throws IOException {
    this.columnFamily = Bytes.readByteArray(in);
    if (this.columnFamily.length == 0) {
        this.columnFamily = null;
    }/*from   ww w  .j av a  2  s.c  o m*/
    this.columnQualifier = Bytes.readByteArray(in);
    if (this.columnQualifier.length == 0) {
        this.columnQualifier = null;
    }
    this.compareOp = CompareOp.valueOf(in.readUTF());
    this.comparator = (WritableByteArrayComparable) HbaseObjectWritable.readObject(in, null);
    this.foundColumn = in.readBoolean();
    this.matchedColumn = in.readBoolean();
    this.filterIfMissing = in.readBoolean();
    this.latestVersionOnly = in.readBoolean();
}

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

/**
 * deserialize//from ww w.j  a  va2s  .  c om
 *
 * @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:com.cloudera.sqoop.lib.LobRef.java

@Override
public void readFields(DataInput in) throws IOException {
    // The serialization format for this object is:
    // boolean isExternal
    // if true, then:
    //   a string identifying the external storage type
    //   and external-storage-specific data.
    // if false, then we use readFieldsInternal() to allow BlobRef/ClobRef
    // to serialize as it sees fit.
    ///*w  w  w  . java2 s. c  o m*/
    // Currently the only external storage supported is LobFile, identified
    // by the string "lf". This serializes with the filename (as a string),
    // followed by a long-valued offset and a long-valued length.

    boolean isExternal = in.readBoolean();
    if (isExternal) {
        this.realData = null;

        String storageType = Text.readString(in);
        if (!storageType.equals("lf")) {
            throw new IOException("Unsupported external LOB storage code: " + storageType);
        }

        // Storage type "lf" is LobFile: filename, offset, length.
        this.fileName = Text.readString(in);
        this.offset = in.readLong();
        this.length = in.readLong();
    } else {
        readFieldsInternal(in);

        this.fileName = null;
        this.offset = 0;
        this.length = 0;
    }
}