Example usage for java.io ObjectInput readInt

List of usage examples for java.io ObjectInput readInt

Introduction

In this page you can find the example usage for java.io ObjectInput readInt.

Prototype

int readInt() throws IOException;

Source Link

Document

Reads four input bytes and returns an int value.

Usage

From source file:org.openfaces.component.table.impl.TableDataModel.java

public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    groupingRules = (List<GroupingRule>) in.readObject();
    sortingRules = (List<SortingRule>) in.readObject();
    rowKeyExpression = ValueBindings.readValueExpression(in);
    rowDataByKeyExpression = ValueBindings.readValueExpression(in);
    pageSize = in.readInt();
    pageIndex = in.readInt();/*w w w .ja v  a  2  s  . c o  m*/
    setWrappedData(null);

    // restoring old extracted row keys is needed for correct restoreRows/restoreRowIndexes functionality, which
    // in turn is required for correct data submission in case of concurrent data modifications
    extractedRowKeys = (List) in.readObject();
}

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.");
    }/* w w w. ja v  a2 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);
        }
        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 . j  a  v 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);
    }
}

From source file:org.apache.lens.server.query.QueryExecutionServiceImpl.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    super.readExternal(in);
    // Restore drivers
    synchronized (drivers) {
        int numDrivers = in.readInt();
        String driverQualifiedName;
        String driverClsName;/* w w  w .j  av a  2 s.c o  m*/
        for (int i = 0; i < numDrivers; i++) {
            driverQualifiedName = in.readUTF();
            driverClsName = in.readUTF();
            LensDriver driver = drivers.get(driverQualifiedName);
            if (driver == null) {
                // this driver is removed in the current server restart
                // we will create an instance and read its state still.
                try {
                    Class<? extends LensDriver> driverCls = (Class<? extends LensDriver>) Class
                            .forName(driverClsName);
                    driver = driverCls.newInstance();
                    String[] driverTypeAndName = StringUtils.split(driverQualifiedName, '/');
                    driver.configure(conf, driverTypeAndName[0], driverTypeAndName[1]);
                } catch (Exception e) {
                    log.error("Could not instantiate driver:{} represented by class {}", driverQualifiedName,
                            driverClsName, e);
                    throw new IOException(e);
                }
                log.info("Driver state for {} will be ignored", driverQualifiedName);
            }
            driver.readExternal(in);
        }
    }

    // Restore queries
    synchronized (allQueries) {
        int numQueries = in.readInt();

        for (int i = 0; i < numQueries; i++) {
            QueryContext ctx = (QueryContext) in.readObject();
            ctx.initTransientState();

            //Create DriverSelectorQueryContext by passing all the drivers and the user query
            //Driver conf gets reset in start
            DriverSelectorQueryContext driverCtx = new DriverSelectorQueryContext(ctx.getUserQuery(),
                    new Configuration(), drivers.values());
            ctx.setDriverContext(driverCtx);
            boolean driverAvailable = in.readBoolean();
            // set the selected driver if available, if not available for the cases of queued queries,
            // query service will do the selection from existing drivers and update
            if (driverAvailable) {
                String selectedDriverQualifiedName = in.readUTF();
                if (drivers.get(selectedDriverQualifiedName) != null) {
                    ctx.getDriverContext().setSelectedDriver(drivers.get(selectedDriverQualifiedName));
                    ctx.setDriverQuery(ctx.getSelectedDriver(), ctx.getSelectedDriverQuery());
                } else {
                    log.info("Ignoring {} as the driver is not loaded", ctx.getQueryHandle());
                    continue;
                }
            }
            allQueries.put(ctx.getQueryHandle(), ctx);
        }
    }
}

From source file:com.sentaroh.android.SMBExplorer.SMBExplorerMain.java

@Override
public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException {
    @SuppressWarnings("unused")
    long sid = input.readLong();
    progressVisible = input.readInt();
    progressCancelBtnText = input.readUTF();
    progressMsgText = input.readUTF();//from ww w.  j ava  2 s  .  co  m
    lclPos = input.readInt();
    lclPosTop = input.readInt();
    profPos = input.readInt();
    profPosTop = input.readInt();
    remPos = input.readInt();
    remPosTop = input.readInt();
    dialogVisible = input.readInt();
    dialogMsgText = input.readUTF();
}