Example usage for java.io ObjectInput readBoolean

List of usage examples for java.io ObjectInput readBoolean

Introduction

In this page you can find the example usage for java.io ObjectInput 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.splicemachine.derby.impl.sql.execute.operations.SpliceBaseOperation.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    this.optimizerEstimatedCost = in.readDouble();
    this.optimizerEstimatedRowCount = in.readDouble();
    this.operationInformation = (OperationInformation) in.readObject();
    isTopResultSet = in.readBoolean();
}

From source file:com.akop.bach.util.SerializableCookie.java

public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    nullMask = in.readInt();//from ww  w. j  a  v  a2 s.com

    String name = null;
    String value = null;
    String comment = null;
    //String commentURL = null;
    Date expiryDate = null;
    //boolean isPersistent = false;
    String domain = null;
    String path = null;
    int[] ports = null;
    boolean isSecure = false;
    int version = 0;

    if ((nullMask & NAME) == 0)
        name = in.readUTF();

    if ((nullMask & VALUE) == 0)
        value = in.readUTF();

    if ((nullMask & COMMENT) == 0)
        comment = in.readUTF();

    if ((nullMask & COMMENT_URL) == 0)
        //commentURL =
        in.readUTF();

    if ((nullMask & EXPIRY_DATE) == 0)
        expiryDate = new Date(in.readLong());

    //isPersistent = 
    in.readBoolean();

    if ((nullMask & DOMAIN) == 0)
        domain = in.readUTF();

    if ((nullMask & PATH) == 0)
        path = in.readUTF();

    if ((nullMask & PORTS) == 0) {
        final int len = in.readInt();
        if (len < 10) {
            ports = new int[len];
            for (int i = 0; i < len; i++)
                ports[i] = in.readInt();
        }
    }

    isSecure = in.readBoolean();
    version = in.readInt();

    final BasicClientCookie bc = new BasicClientCookie(name, value);
    bc.setComment(comment);
    bc.setDomain(domain);
    bc.setExpiryDate(expiryDate);
    bc.setPath(path);
    bc.setSecure(isSecure);
    bc.setVersion(version);

    this.cookie = bc;
}

From source file:net.lightbody.bmp.proxy.jetty.jetty.servlet.WebApplicationContext.java

public void readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException {
    setContextPath((String) in.readObject());
    setVirtualHosts((String[]) in.readObject());
    Object o = in.readObject();/* www  .  ja v a2 s  .  c om*/

    while (o instanceof HttpHandler) {
        addHandler((HttpHandler) o);
        o = in.readObject();
    }
    setAttributes((Map) o);
    setRedirectNullPath(in.readBoolean());
    setMaxCachedFileSize(in.readInt());
    setMaxCacheSize(in.readInt());
    setStatsOn(in.readBoolean());
    setPermissions((PermissionCollection) in.readObject());
    setClassLoaderJava2Compliant(in.readBoolean());

    _defaultsDescriptor = (String) in.readObject();
    _war = (String) in.readObject();
    _extract = in.readBoolean();
    _ignorewebjetty = in.readBoolean();
    _distributable = in.readBoolean();
    _configurationClassNames = (String[]) in.readObject();
}

From source file:org.apache.rahas.Token.java

/**
 * Implementing de-serialization logic in accordance with the serialization logic.
 * @param in Stream which used to read data.
 * @throws IOException If unable to de-serialize particular data member.
 * @throws ClassNotFoundException // w w  w.  j  a v a  2  s .  c om
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    this.id = (String) in.readObject();

    this.state = in.readInt();

    String stringElement = (String) in.readObject();
    this.token = convertStringToOMElement(stringElement);

    stringElement = (String) in.readObject();
    this.previousToken = convertStringToOMElement(stringElement);

    stringElement = (String) in.readObject();
    this.attachedReference = convertStringToOMElement(stringElement);

    stringElement = (String) in.readObject();
    this.unattachedReference = convertStringToOMElement(stringElement);

    this.properties = (Properties) in.readObject();

    this.changed = in.readBoolean();

    // Read the length of the secret
    int secretLength = in.readInt();

    if (0 != secretLength) {
        byte[] buffer = new byte[secretLength];
        if (secretLength != in.read(buffer)) {
            throw new IllegalStateException("Bytes read from the secret key is not equal to serialized length");
        }
        this.secret = buffer;
    } else {
        this.secret = null;
    }

    this.created = (Date) in.readObject();

    this.expires = (Date) in.readObject();

    this.issuerAddress = (String) in.readObject();

    this.encrKeySha1Value = (String) in.readObject();
}

From source file:org.apache.openjpa.lib.conf.ConfigurationImpl.java

/**
 * Implementation of the {@link Externalizable} interface to read from
 * the properties written by {@link #writeExternal}.
 *///  w ww .j av  a  2 s . co m
@SuppressWarnings("unchecked")
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    fromProperties((Map) in.readObject());
    _props = (Map) in.readObject();
    _globals = in.readBoolean();
}

From source file:LayeredPaneDemo4.java

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    setTitleBarBackground((Color) in.readObject());
    setTitleBarForeground((Color) in.readObject());
    setBorderColor((Color) in.readObject());
    setSelectedTitleBarBackground((Color) in.readObject());
    setSelectedBorderColor((Color) in.readObject());

    setTitle((String) in.readObject());

    setIconizeable(in.readBoolean());
    setResizeable(in.readBoolean());// ww  w  .  j a v  a  2 s .c  o m
    setCloseable(in.readBoolean());
    setMaximizeable(in.readBoolean());
    setSelected(false);

    setFrameIcon((ImageIcon) in.readObject());
    Rectangle r = (Rectangle) in.readObject();
    r.x = getX();
    r.y = getY();
    setBounds(r.x, r.x, r.width, r.height);
}

From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileTool.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    setBlockUpdate(true);//  www  .  j av a 2 s .co  m
    int version = in.readInt();

    dataPoints = in.readInt();
    crossColor = new Color(in.readInt());
    pointSize = in.readDouble();

    value = new float[in.readInt()];
    for (int i = 0; i < value.length; i++) {
        value[i] = in.readFloat();
    }

    selectionData = new float[in.readInt()];
    for (int i = 0; i < selectionData.length; i++) {
        selectionData[i] = in.readFloat();
    }

    useData = new boolean[in.readInt()];
    for (int i = 0; i < useData.length; i++) {
        useData[i] = in.readBoolean();
    }

    offset.setValue(in.readDouble());
    showOffset.setSelected(in.readBoolean());

    setBlockUpdate(false);
    // dataPoints = p.dataPoints;
    // crossColor = new Color(p.crossColor.getRGB());
    // pointSize = p.pointSize;
    // value = new float[p.value.length];
    // for (int i = 0; i < value.length; i++)
    // {
    // value[i] = p.value[i];
    // }
    //
    // selectionData = new float[p.selectionData.length];
    // for (int i = 0; i < selectionData.length; i++)
    // {
    // selectionData[i] = p.selectionData[i];
    // }
    //
    // useData = new boolean[p.useData.length];
    // for (int i = 0; i < useData.length; i++)
    // {
    // useData[i] = p.useData[i];
    // }
    //
    // offset.setValue(p.offset.getValue());
    // showOffset.setSelected(p.showOffset.isSelected());
}

From source file:com.inmobi.grill.server.query.QueryExecutionServiceImpl.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    super.readExternal(in);
    Map<String, GrillDriver> driverMap = new HashMap<String, GrillDriver>();
    synchronized (drivers) {
        drivers.clear();//from  w w  w.  ja va  2s .  co  m
        int numDrivers = in.readInt();
        for (int i = 0; i < numDrivers; i++) {
            String driverClsName = in.readUTF();
            GrillDriver driver;
            try {
                Class<? extends GrillDriver> driverCls = (Class<? extends GrillDriver>) Class
                        .forName(driverClsName);
                driver = (GrillDriver) driverCls.newInstance();
                driver.configure(conf);
            } catch (Exception e) {
                LOG.error("Could not instantiate driver:" + driverClsName);
                throw new IOException(e);
            }
            driver.readExternal(in);
            drivers.add(driver);
            driverMap.put(driverClsName, driver);
        }
    }
    synchronized (allQueries) {
        int numQueries = in.readInt();
        for (int i = 0; i < numQueries; i++) {
            QueryContext ctx = (QueryContext) in.readObject();
            allQueries.put(ctx.getQueryHandle(), ctx);
            boolean driverAvailable = in.readBoolean();
            if (driverAvailable) {
                String clsName = in.readUTF();
                ctx.setSelectedDriver(driverMap.get(clsName));
            }
            try {
                ctx.setConf(getGrillConf(null, ctx.getQconf()));
            } catch (GrillException e) {
                LOG.error("Could not set query conf");
            }
        }

        // populate the query queues
        for (QueryContext ctx : allQueries.values()) {
            switch (ctx.getStatus().getStatus()) {
            case NEW:
            case QUEUED:
                // queued queries wont recovered.
                try {
                    setFailedStatus(ctx, "Launching query failed due to server restart", "Server is restarted");
                } catch (GrillException e) {
                    LOG.error("Failing query " + ctx.getQueryHandle() + " failed", e);
                }
                break;
            case LAUNCHED:
            case RUNNING:
                launchedQueries.add(ctx);
                break;
            case SUCCESSFUL:
            case FAILED:
            case CANCELED:
                updateFinishedQuery(ctx, null);
                break;
            case CLOSED:
                allQueries.remove(ctx.getQueryHandle());
            }
        }
        LOG.info("Recovered " + allQueries.size() + " queries");
    }
}

From source file:org.codehaus.groovy.grails.web.util.StreamCharBuffer.java

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    int version = in.readInt();
    if (version != EXTERNALIZABLE_VERSION) {
        throw new IOException("Uncompatible version in serialization stream.");
    }/*from   w w  w.  jav a2s . c o m*/
    reset();
    int len = in.readInt();
    if (len > 0) {
        char[] buf = new char[len];
        Reader reader = new InputStreamReader((InputStream) in, "UTF-8");
        reader.read(buf);
        String str = StringCharArrayAccessor.createString(buf);
        MultipartStringChunk mpStringChunk = new MultipartStringChunk(str);
        int partCount = in.readInt();
        for (int i = 0; i < partCount; i++) {
            EncodingStatePart current = new EncodingStatePart();
            mpStringChunk.appendEncodingStatePart(current);
            current.len = in.readInt();
            int encodersSize = in.readInt();
            Set<Encoder> encoders = null;
            if (encodersSize > 0) {
                encoders = new LinkedHashSet<Encoder>();
                for (int j = 0; j < encodersSize; j++) {
                    String codecName = in.readUTF();
                    boolean safe = in.readBoolean();
                    encoders.add(new SavedEncoder(codecName, safe));
                }
            }
            current.encodingState = new EncodingStateImpl(encoders);
        }
        addChunk(mpStringChunk);
    }
}

From source file:org.grails.buffer.StreamCharBuffer.java

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    int version = in.readInt();
    if (version != EXTERNALIZABLE_VERSION) {
        throw new IOException("Uncompatible version in serialization stream.");
    }// w  w w  . jav  a  2 s  .  co m
    reset();
    int len = in.readInt();
    if (len > 0) {
        char[] buf = new char[len];
        Reader reader = new InputStreamReader((InputStream) in, "UTF-8");
        reader.read(buf);
        String str = StringCharArrayAccessor.createString(buf);
        MultipartStringChunk mpStringChunk = new MultipartStringChunk(str);
        int partCount = in.readInt();
        for (int i = 0; i < partCount; i++) {
            EncodingStatePart current = new EncodingStatePart();
            mpStringChunk.appendEncodingStatePart(current);
            current.len = in.readInt();
            int encodersSize = in.readInt();
            Set<Encoder> encoders = null;
            if (encodersSize > 0) {
                encoders = new LinkedHashSet<Encoder>();
                for (int j = 0; j < encodersSize; j++) {
                    String codecName = in.readUTF();
                    boolean safe = in.readBoolean();
                    encoders.add(new SavedEncoder(codecName, safe));
                }
            }
            current.encodingState = new EncodingStateImpl(encoders, null);
        }
        addChunk(mpStringChunk);
    }
}