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.chinamobile.bcbsp.ml.VectorWritable.java

public static DoubleVector readVector(DataInput in) throws IOException {
    int length = in.readInt();
    DoubleVector vector;//  w  w  w.  j av a  2 s  .co m
    vector = new DenseDoubleVector(length);
    for (int i = 0; i < length; i++) {
        vector.set(i, in.readDouble());
    }

    if (in.readBoolean()) {
        vector = new NamedDoubleVector(in.readUTF(), vector);
    }
    return vector;
}

From source file:com.bigdata.dastor.utils.FBUtilities.java

public static String readNullableString(DataInput dis) throws IOException {
    if (dis.readBoolean())
        return null;
    return dis.readUTF();
}

From source file:mobi.hsz.idea.gitignore.indexing.IgnoreEntryOccurrence.java

/**
 * Static helper to read {@link IgnoreEntryOccurrence} from the input stream.
 *
 * @param in input stream/*from   ww  w  .jav  a 2  s .  c om*/
 * @return read {@link IgnoreEntryOccurrence}
 */
@Nullable
public static synchronized IgnoreEntryOccurrence deserialize(@NotNull DataInput in) {
    try {
        String path = in.readUTF();
        if (StringUtils.isEmpty(path)) {
            return null;
        }
        VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path);
        if (file == null || !file.exists() || file.isDirectory()) {
            return null;
        }

        IgnoreEntryOccurrence entry = new IgnoreEntryOccurrence(file);
        int size = in.readInt();
        for (int i = 0; i < size; i++) {
            Pattern pattern = Pattern.compile(in.readUTF());
            Boolean isNegated = in.readBoolean();
            entry.add(pattern, isNegated);
        }
        return entry;
    } catch (IOException e) {
        return null;
    }
}

From source file:com.splicemachine.derby.impl.sql.execute.operations.SpliceBaseOperation.java

public static String readNullableString(DataInput in) throws IOException {
    if (in.readBoolean())
        return in.readUTF();
    return null;/*w ww. j  a va 2s.c  o  m*/
}

From source file:org.pivotal.customer.versonix.support.PaxReserveType.java

@Override
public void fromData(DataInput in) throws IOException {
    id = in.readUTF();
    linked = in.readBoolean();
}

From source file:IndexService.IColumnInputSplit.java

@Override
public void readFields(DataInput in) throws IOException {
    this.file = new Path(in.readUTF());
    this.splitbyline = in.readBoolean();
    this.wholefileASasplit = in.readBoolean();
    if (splitbyline) {
        if (!wholefileASasplit) {
            this.beginline = in.readInt();
            this.recnum = in.readInt();
        }/*  w w w  . j a  v a  2s .c  o m*/
    } else {
        this.beginkey = new IRecord.IFValue();
        beginkey.readFields(in);
        this.recnum = in.readInt();
    }
}

From source file:IndexService.IndexMergeIFormatSplit.java

@Override
public void readFields(DataInput in) throws IOException {
    this.file = new Path(in.readUTF());
    this.splitbyline = in.readBoolean();
    this.wholefileASasplit = in.readBoolean();
    if (splitbyline) {
        if (!wholefileASasplit) {
            this.beginline = in.readInt();
            this.recnum = in.readInt();
        }//from  w w  w.  j  a  v a 2 s .  c  o  m
    } else {
        this.beginkey = new IRecord.IFValue();
        beginkey.readFields(in);
        this.recnum = in.readInt();
    }

}

From source file:ipc.ConnectionHeader.java

@Override
public void readFields(DataInput in) throws IOException {
    protocol = Text.readString(in);
    if (protocol.isEmpty()) {
        protocol = null;//from   w w  w  . java  2 s. co m
    }

    boolean ugiUsernamePresent = in.readBoolean();
}

From source file:com.twitter.hraven.etl.JobFile.java

@Override
public void readFields(DataInput in) throws IOException {
    this.filename = Text.readString(in);
    this.jobid = Text.readString(in);
    this.isJobConfFile = in.readBoolean();
    this.isJobHistoryFile = in.readBoolean();
}

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

@Override
public void readFromPickle(int version, DataInput in) throws IOException, PickleException {
    T.UI();//  w  w w  . j a v  a 2  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();
}