Example usage for java.io ObjectOutput writeInt

List of usage examples for java.io ObjectOutput writeInt

Introduction

In this page you can find the example usage for java.io ObjectOutput writeInt.

Prototype

void writeInt(int v) throws IOException;

Source Link

Document

Writes an int value, which is comprised of four bytes, to the output stream.

Usage

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

public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
    out.writeObject(getContextPath());// w  ww  .  j  a  v a2 s. c om
    out.writeObject(getVirtualHosts());
    HttpHandler[] handlers = getHandlers();
    for (int i = 0; i < handlers.length; i++) {
        if (handlers[i] instanceof WebApplicationHandler)
            break;
        out.writeObject(handlers[i]);
    }
    out.writeObject(getAttributes());
    out.writeBoolean(isRedirectNullPath());
    out.writeInt(getMaxCachedFileSize());
    out.writeInt(getMaxCacheSize());
    out.writeBoolean(getStatsOn());
    out.writeObject(getPermissions());
    out.writeBoolean(isClassLoaderJava2Compliant());

    out.writeObject(_defaultsDescriptor);
    out.writeObject(_war);
    out.writeBoolean(_extract);
    out.writeBoolean(_ignorewebjetty);
    out.writeBoolean(_distributable);

    out.writeObject(_configurationClassNames);
}

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

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(sortingRules);//  ww w .  ja v a2  s. com
    ValueBindings.writeValueExpression(out, rowKeyExpression);
    ValueBindings.writeValueExpression(out, rowDataByKeyExpression);
    out.writeInt(pageSize);
    out.writeInt(pageIndex);
    out.writeObject(extractedRowKeys);
}

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

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    int version = 1;
    out.writeInt(version);

    out.writeInt(dataPoints);//from  w  w w .  j a  va  2  s  .  c  o m
    out.writeInt(crossColor.getRGB());
    out.writeDouble(pointSize);

    out.writeInt(value.length);
    for (int i = 0; i < value.length; i++) {
        out.writeFloat(value[i]);
    }

    out.writeInt(selectionData.length);
    for (int i = 0; i < selectionData.length; i++) {
        out.writeFloat(selectionData[i]);
    }

    out.writeInt(useData.length);
    for (int i = 0; i < useData.length; i++) {
        out.writeBoolean(useData[i]);
    }

    out.writeDouble((Double) offset.getValue());
    out.writeBoolean(showOffset.isSelected());

}

From source file:gnu.trove.map.custom_hash.TObjectByteCustomHashMap.java

public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION//ww w.  j  av  a 2  s  . com
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // STRATEGY
    out.writeObject(strategy);

    // NO_ENTRY_VALUE
    out.writeByte(no_entry_value);

    // NUMBER OF ENTRIES
    out.writeInt(_size);

    // ENTRIES
    for (int i = _set.length; i-- > 0;) {
        if (_set[i] != REMOVED && _set[i] != FREE) {
            out.writeObject(_set[i]);
            out.writeByte(_values[i]);
        }
    }
}

From source file:gnu.trove.map.custom_hash.TObjectCharCustomHashMap.java

public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION//w w  w. j  a v a 2 s.  c  o m
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // STRATEGY
    out.writeObject(strategy);

    // NO_ENTRY_VALUE
    out.writeChar(no_entry_value);

    // NUMBER OF ENTRIES
    out.writeInt(_size);

    // ENTRIES
    for (int i = _set.length; i-- > 0;) {
        if (_set[i] != REMOVED && _set[i] != FREE) {
            out.writeObject(_set[i]);
            out.writeChar(_values[i]);
        }
    }
}

From source file:gnu.trove.map.custom_hash.TObjectFloatCustomHashMap.java

public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION/*from   w w  w.j a  va 2s  .c o  m*/
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // STRATEGY
    out.writeObject(strategy);

    // NO_ENTRY_VALUE
    out.writeFloat(no_entry_value);

    // NUMBER OF ENTRIES
    out.writeInt(_size);

    // ENTRIES
    for (int i = _set.length; i-- > 0;) {
        if (_set[i] != REMOVED && _set[i] != FREE) {
            out.writeObject(_set[i]);
            out.writeFloat(_values[i]);
        }
    }
}

From source file:gnu.trove.map.custom_hash.TObjectDoubleCustomHashMap.java

public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION//  w  ww .  j  a v a 2  s .  com
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // STRATEGY
    out.writeObject(strategy);

    // NO_ENTRY_VALUE
    out.writeDouble(no_entry_value);

    // NUMBER OF ENTRIES
    out.writeInt(_size);

    // ENTRIES
    for (int i = _set.length; i-- > 0;) {
        if (_set[i] != REMOVED && _set[i] != FREE) {
            out.writeObject(_set[i]);
            out.writeDouble(_values[i]);
        }
    }
}

From source file:org.apache.lens.driver.hive.HiveDriver.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    // Write the query handle to hive handle map to output
    synchronized (hiveHandles) {
        out.writeInt(hiveHandles.size());
        for (Map.Entry<QueryHandle, OperationHandle> entry : hiveHandles.entrySet()) {
            out.writeObject(entry.getKey());
            out.writeObject(entry.getValue().toTOperationHandle());
            log.debug("Hive driver {} persisted {}:{}", getFullyQualifiedName(), entry.getKey(),
                    entry.getValue());/*from  ww  w  .ja  va 2s  .  com*/
        }
        log.info("Hive driver {} persisted {} queries ", getFullyQualifiedName(), hiveHandles.size());
        out.writeInt(lensToHiveSession.size());
        for (Map.Entry<String, SessionHandle> entry : lensToHiveSession.entrySet()) {
            out.writeUTF(entry.getKey());
            out.writeObject(entry.getValue().toTSessionHandle());
        }
        log.info("Hive driver {} persisted {} sessions", getFullyQualifiedName(), lensToHiveSession.size());
        out.writeInt(opHandleToSession.size());
        for (Map.Entry<OperationHandle, SessionHandle> entry : opHandleToSession.entrySet()) {
            out.writeObject(entry.getKey().toTOperationHandle());
            out.writeObject(entry.getValue().toTSessionHandle());
        }
        log.info("Hive driver {} persisted {} operation handles", getFullyQualifiedName(),
                opHandleToSession.size());
        out.writeInt(orphanedHiveSessions.size());
        for (SessionHandle sessionHandle : orphanedHiveSessions) {
            out.writeObject(sessionHandle.toTSessionHandle());
        }
        log.info("Hive driver {} persisted {} orphaned sessions", getFullyQualifiedName(),
                orphanedHiveSessions.size());
    }
}

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

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(groupingRules);/*  w  w w  . ja v  a  2s.co  m*/
    out.writeObject(sortingRules);
    ValueBindings.writeValueExpression(out, rowKeyExpression);
    ValueBindings.writeValueExpression(out, rowDataByKeyExpression);
    out.writeInt(pageSize);
    out.writeInt(pageIndex);
    out.writeObject(extractedRowKeys);
}

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

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(EXTERNALIZABLE_VERSION);
    StringChunk stringChunk = readToSingleStringChunk(false);
    if (stringChunk != null && stringChunk.str.length() > 0) {
        char[] buf = StringCharArrayAccessor.getValue(stringChunk.str);
        out.writeInt(buf.length);/*from  w  w  w.  ja  v a  2s. c  o  m*/
        Writer writer = new OutputStreamWriter((OutputStream) out, "UTF-8");
        writer.write(buf);
        writer.flush();
        if (stringChunk instanceof MultipartStringChunk) {
            MultipartStringChunk mpStringChunk = (MultipartStringChunk) stringChunk;
            out.writeInt(mpStringChunk.partCount());
            EncodingStatePart current = mpStringChunk.firstPart;
            while (current != null) {
                out.writeInt(current.len);
                if (current.encodingState != null && current.encodingState.getEncoders() != null
                        && current.encodingState.getEncoders().size() > 0) {
                    out.writeInt(current.encodingState.getEncoders().size());
                    for (Encoder encoder : current.encodingState.getEncoders()) {
                        out.writeUTF(encoder.getCodecIdentifier().getCodecName());
                        out.writeBoolean(encoder.isSafe());
                    }
                } else {
                    out.writeInt(0);
                }
                current = current.next;
            }
        } else {
            out.writeInt(0);
        }
    } else {
        out.writeInt(0);
    }
}