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.fiorano.openesb.application.aps.ServiceInstance.java

/**
 *  This method reads this object <code>ServiceInstance</code> from the
 *  specified object of input stream./*  www .j  a v  a 2 s  .c  o m*/
 *
 * @param is DataInput object
 * @param versionNo
 * @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_isManualLaunch = is.readBoolean();

    m_isStateful = is.readBoolean();

    m_isDelayedLaunch = is.readBoolean();

    String temp = UTFReaderWriter.readUTF(is);

    if (temp == null)
        m_delayedPortName = "";
    else
        m_delayedPortName = temp;

    m_isTransacted = is.readBoolean();

    m_isErrorHandlingEnabled = is.readBoolean();

    m_isVersionLocked = is.readBoolean();

    m_isEndOfWorkflow = is.readBoolean();

    m_isInMemoryLaunch = is.readBoolean();

    m_isTransportLPC = is.readBoolean();

    m_bPreferLaunchOnHigherLevelNode = is.readBoolean();

    m_bIsDurableSubscription = is.readBoolean();

    m_bIsDurableConnection = is.readBoolean();

    m_bKillPrimaryOnSecondaryLaunch = is.readBoolean();

    m_bIsDebugMode = is.readBoolean();

    m_iDebugPort = is.readInt();

    m_maxRetries = is.readInt();

    temp = UTFReaderWriter.readUTF(is);
    if (temp.equals(""))
        m_version = null;
    else
        m_version = temp;

    m_dBufferSizePerPort = is.readLong();

    temp = UTFReaderWriter.readUTF(is);
    if (temp.equals(""))
        m_servInstName = null;
    else
        m_servInstName = temp;

    temp = UTFReaderWriter.readUTF(is);
    if (temp.equals(""))
        m_servGUID = null;
    else
        m_servGUID = temp;

    temp = UTFReaderWriter.readUTF(is);
    if (temp.equals(""))
        m_longDescription = null;
    else
        m_longDescription = temp;

    temp = UTFReaderWriter.readUTF(is);
    if (temp.equals(""))
        m_shortDescription = null;
    else
        m_shortDescription = temp;

    // Service Dependency
    int tempInt = is.readInt();

    for (int i = 0; i < tempInt; ++i) {
        RuntimeDependency serv = new RuntimeDependency();

        serv.fromStream(is, versionNo);
        m_runtimeDependencies.addElement(serv);
    }

    tempInt = is.readInt();

    if (tempInt != 0) {
        m_runtimeArgs = new RuntimeArgs();
        m_runtimeArgs.fromStream(is, versionNo);
    }

    tempInt = is.readInt();
    if (tempInt != 0) {
        m_portInstDescriptor = new PortInstDescriptor();
        m_portInstDescriptor.fromStream(is, versionNo);
    }

    if ((tempInt = is.readInt()) != 0)
        for (int i = 0; i < tempInt; i++) {
            Param param = new Param();

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

    tempInt = is.readInt();
    if (tempInt != 0) {
        m_statusTracking = new StatusTracking();
        m_statusTracking.fromStream(is, versionNo);
    }

    tempInt = is.readInt();

    if (tempInt != 0) {
        m_vecEndStates = new Vector();
        for (int i = 0; i < tempInt; i++) {
            EndState endState = new EndState();

            endState.fromStream(is, versionNo);
            m_vecEndStates.add(endState);

        }
    }

    tempInt = is.readInt();
    if (tempInt != 0)
        for (int i = 0; i < tempInt; i++)
            m_nodes.put(UTFReaderWriter.readUTF(is), UTFReaderWriter.readUTF(is));

    tempInt = is.readInt();
    if (tempInt != 0) {
        m_monitor = new Monitor();
        m_monitor.fromStream(is, versionNo);
    }

    tempInt = is.readInt();
    if (tempInt != 0) {
        m_logModules = new LogModules();
        m_logModules.fromStream(is, versionNo);
    }

    // Log Manager and log params
    m_logManager = readUTF(is);
    m_profile = readUTF(is);

    if ((tempInt = is.readInt()) != 0)
        for (int i = 0; i < tempInt; i++) {
            Param param = new Param();

            param.fromStream(is, versionNo);
            m_logParams.add(param);
        }

    //  Event Parameters.
    m_eventDeliveryMode = readUTF(is);
    m_eventExpiryTime = is.readLong();
    m_eventHandler = is.readInt();
}

From source file:org.apache.accumulo.core.client.mapreduce.RangeInputSplit.java

@Override
public void readFields(DataInput in) throws IOException {
    range.readFields(in);/*from   w w  w.j  a va  2  s .  c o m*/
    tableName = in.readUTF();
    tableId = in.readUTF();
    int numLocs = in.readInt();
    locations = new String[numLocs];
    for (int i = 0; i < numLocs; ++i)
        locations[i] = in.readUTF();

    if (in.readBoolean()) {
        isolatedScan = in.readBoolean();
    }

    if (in.readBoolean()) {
        offline = in.readBoolean();
    }

    if (in.readBoolean()) {
        localIterators = in.readBoolean();
    }

    if (in.readBoolean()) {
        mockInstance = in.readBoolean();
    }

    if (in.readBoolean()) {
        int numColumns = in.readInt();
        List<String> columns = new ArrayList<String>(numColumns);
        for (int i = 0; i < numColumns; i++) {
            columns.add(in.readUTF());
        }

        fetchedColumns = InputConfigurator.deserializeFetchedColumns(columns);
    }

    if (in.readBoolean()) {
        String strAuths = in.readUTF();
        auths = new Authorizations(strAuths.getBytes(Constants.UTF8));
    }

    if (in.readBoolean()) {
        principal = in.readUTF();
    }

    if (in.readBoolean()) {
        int ordinal = in.readInt();
        this.tokenSource = TokenSource.values()[ordinal];

        switch (this.tokenSource) {
        case INLINE:
            String tokenClass = in.readUTF();
            byte[] base64TokenBytes = in.readUTF().getBytes(Constants.UTF8);
            byte[] tokenBytes = Base64.decodeBase64(base64TokenBytes);

            this.token = AuthenticationTokenSerializer.deserialize(tokenClass, tokenBytes);
            break;

        case FILE:
            this.tokenFile = in.readUTF();

            break;
        default:
            throw new IOException("Cannot parse unknown TokenSource ordinal");
        }
    }

    if (in.readBoolean()) {
        instanceName = in.readUTF();
    }

    if (in.readBoolean()) {
        zooKeepers = in.readUTF();
    }

    if (in.readBoolean()) {
        level = Level.toLevel(in.readInt());
    }
}

From source file:org.apache.carbondata.core.metadata.blocklet.BlockletInfo.java

@Override
public void readFields(DataInput input) throws IOException {
    dimensionOffset = input.readLong();//from   w  w  w  .  jav  a  2  s. co m
    measureOffsets = input.readLong();
    int dimensionChunkOffsetsSize = input.readShort();
    dimensionChunkOffsets = new ArrayList<>(dimensionChunkOffsetsSize);
    for (int i = 0; i < dimensionChunkOffsetsSize; i++) {
        dimensionChunkOffsets.add(input.readLong());
    }
    dimensionChunksLength = new ArrayList<>(dimensionChunkOffsetsSize);
    for (int i = 0; i < dimensionChunkOffsetsSize; i++) {
        dimensionChunksLength.add(input.readInt());
    }

    short measureChunkOffsetsSize = input.readShort();
    measureChunkOffsets = new ArrayList<>(measureChunkOffsetsSize);
    for (int i = 0; i < measureChunkOffsetsSize; i++) {
        measureChunkOffsets.add(input.readLong());
    }
    measureChunksLength = new ArrayList<>(measureChunkOffsetsSize);
    for (int i = 0; i < measureChunkOffsetsSize; i++) {
        measureChunksLength.add(input.readInt());
    }
    readChunkInfoForOlderVersions(input);
    final boolean isSortedPresent = input.readBoolean();
    if (isSortedPresent) {
        this.isSorted = input.readBoolean();
    }
    numberOfRowsPerPage = new int[input.readShort()];
    for (int i = 0; i < numberOfRowsPerPage.length; i++) {
        numberOfRowsPerPage[i] = input.readInt();
    }
}

From source file:org.apache.carbondata.core.metadata.schema.table.DataMapSchema.java

@Override
public void readFields(DataInput in) throws IOException {
    this.dataMapName = in.readUTF();
    this.providerName = in.readUTF();
    boolean isRelationIdentifierExists = in.readBoolean();
    if (isRelationIdentifierExists) {
        this.relationIdentifier = new RelationIdentifier(null, null, null);
        this.relationIdentifier.readFields(in);
    }/*from www.  jav a2  s.  c  om*/
    boolean isChildSchemaExists = in.readBoolean();
    if (isChildSchemaExists) {
        this.childSchema = new TableSchema();
        this.childSchema.readFields(in);
    }

    int mapSize = in.readShort();
    this.properties = new HashMap<>(mapSize);
    for (int i = 0; i < mapSize; i++) {
        String key = in.readUTF();
        String value = in.readUTF();
        this.properties.put(key, value);
    }
}

From source file:org.apache.geode.distributed.internal.StartupMessage.java

@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    super.fromData(in);

    this.version = DataSerializer.readString(in);
    this.replyProcessorId = in.readInt();
    this.isMcastEnabled = in.readBoolean();
    this.isTcpDisabled = in.readBoolean();

    int serializerCount = in.readInt();
    for (int i = 0; i < serializerCount; i++) {
        String cName = DataSerializer.readNonPrimitiveClassName(in);

        int id = in.readInt(); // id
        try {//w w w  .j a  v  a 2 s  . co  m
            if (cName != null) {
                InternalDataSerializer.register(cName, false, null, null, id);
            }
        } catch (IllegalArgumentException ex) {
            fromDataProblem(
                    LocalizedStrings.StartupMessage_ILLEGALARGUMENTEXCEPTION_WHILE_REGISTERING_A_DATASERIALIZER_0
                            .toLocalizedString(ex));
        }
    }

    int instantiatorCount = in.readInt();
    for (int i = 0; i < instantiatorCount; i++) {
        String instantiatorClassName = DataSerializer.readNonPrimitiveClassName(in);
        String instantiatedClassName = DataSerializer.readNonPrimitiveClassName(in);
        int id = in.readInt();

        try {
            if (instantiatorClassName != null && instantiatedClassName != null) {
                InternalInstantiator.register(instantiatorClassName, instantiatedClassName, id, false);
            }
        } catch (IllegalArgumentException ex) {
            fromDataProblem(
                    LocalizedStrings.StartupMessage_ILLEGALARGUMENTEXCEPTION_WHILE_REGISTERING_AN_INSTANTIATOR_0
                            .toLocalizedString(ex));
        }
    } // for

    this.interfaces = (Set) DataSerializer.readObject(in);
    this.distributedSystemId = in.readInt();
    this.redundancyZone = DataSerializer.readString(in);
    this.enforceUniqueZone = in.readBoolean();

    StartupMessageData data = new StartupMessageData();
    data.readFrom(in);
    this.hostedLocatorsAll = data.readHostedLocators();
    this.isSharedConfigurationEnabled = data.readIsSharedConfigurationEnabled();
    this.mcastPort = data.readMcastPort();
    this.mcastHostAddress = data.readMcastHostAddress();
}

From source file:org.apache.geode.internal.InternalDataSerializer.java

/** read a set of Long objects */
public static Set<Long> readSetOfLongs(DataInput in) throws IOException {
    int size = in.readInt();
    if (size < 0) {
        return null;
    } else {//from  ww w. j  av  a  2s .c  o  m
        Set result = new HashSet(size);
        boolean longIDs = in.readBoolean();
        for (int i = 0; i < size; i++) {
            long l = longIDs ? in.readLong() : in.readInt();
            result.add(l);
        }
        return result;
    }
}

From source file:org.apache.geode.internal.InternalDataSerializer.java

/** read a set of Long objects */
public static List<Long> readListOfLongs(DataInput in) throws IOException {
    int size = in.readInt();
    if (size < 0) {
        return null;
    } else {/*from   w ww .  j av a  2  s. c om*/
        List result = new LinkedList();
        boolean longIDs = in.readBoolean();
        for (int i = 0; i < size; i++) {
            long l = longIDs ? in.readLong() : in.readInt();
            result.add(l);
        }
        return result;
    }
}

From source file:org.apache.geode.management.internal.configuration.messages.ConfigurationRequest.java

@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    this.isRequestForEntireConfiguration = in.readBoolean();
    int size = in.readInt();
    Set<String> groups = new HashSet<>();
    if (size > 0) {
        for (int i = 0; i < size; i++) {
            groups.add(in.readUTF());/*from  w ww  .  j a va  2s  .c  o m*/
        }
    }
    this.groups = groups;
    this.numAttempts = in.readInt();
}

From source file:org.apache.giraph.ooc.DiskBackedPartitionStore.java

/**
 * Read vertex data from an input and initialize the vertex.
 *
 * @param in The input stream/*  www .j  a va  2  s. c  o m*/
 * @param vertex The vertex to initialize
 * @throws IOException
 */
private void readVertexData(DataInput in, Vertex<I, V, E> vertex) throws IOException {

    I id = conf.createVertexId();
    id.readFields(in);
    V value = conf.createVertexValue();
    value.readFields(in);
    OutEdges<I, E> edges = conf.createAndInitializeOutEdges(0);
    vertex.initialize(id, value, edges);
    if (in.readBoolean()) {
        vertex.voteToHalt();
    } else {
        vertex.wakeUp();
    }
}

From source file:org.apache.giraph.partition.DiskBackedOnlineComputePartitionStore.java

/**
 * Read vertex data from an input and initialize the vertex.
 * /*  w  w  w  .  j a  va 2s .  com*/
 * @param in
 *            The input stream
 * @param vertex
 *            The vertex to initialize
 * @throws IOException
 */
private void readVertexData(DataInput in, Vertex<I, V, E, M> vertex) throws IOException {
    I id = conf.createVertexId();
    id.readFields(in);
    V value = conf.createVertexValue();
    value.readFields(in);
    vertex.initialize(id, value);
    if (in.readBoolean()) {
        vertex.voteToHalt();
    } else {
        vertex.wakeUp();
    }
}