Example usage for java.io ObjectOutput writeLong

List of usage examples for java.io ObjectOutput writeLong

Introduction

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

Prototype

void writeLong(long v) throws IOException;

Source Link

Document

Writes a long value, which is comprised of eight bytes, to the output stream.

Usage

From source file:xbird.xquery.misc.BasicStringChunk.java

public void writeExternal(final ObjectOutput out) throws IOException {
    out.writeObject(_strPool);/*from w w w .j a  v a2 s.  c o  m*/
    out.writeObject(_cchunks);
    out.writeLong(_cpointer);
}

From source file:com.delphix.session.impl.frame.SerialNumber.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeByte(serialBits);// ww w .  ja  v  a 2  s.c  om

    if (serialBits < Byte.SIZE) {
        out.writeByte((int) serialNumber);
    } else if (serialBits < Short.SIZE) {
        out.writeShort((int) serialNumber);
    } else if (serialBits < Integer.SIZE) {
        out.writeInt((int) serialNumber);
    } else {
        out.writeLong(serialNumber);
    }
}

From source file:org.perf.log.logger.PerfLogData.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    // write out the desired fields
    out.writeLong(getTransactionTime());
    writeStr(getGuid(), out);/*from w  w w . j av  a  2s . c  om*/
    writeStr(getSessionId(), out);
    writeStr(getThreadName(), out);
    writeStr(getThreadId(), out);
    if (getTransactionDate() != null)
        out.writeLong(getTransactionDate().getTime());
    else
        out.writeLong(new Date().getTime());

    writeStr(getServerName(), out);
    writeStr(getServerIp(), out);
    writeStr(getCloneName(), out);
    out.writeInt(getJvmDepth());
    out.writeInt(getTxnFilterDepth());
    writeStr(getTransactionType(), out);
    writeStr(getUserId(), out);
    writeStr(getTransactionName(), out);
    writeStr(getSubTransactionName(), out);
    writeStr(getTransactionClass(), out);
    writeStr(getInfoContextString(), out);
    writeStr(getMessage(), out);
    writeStr(getThrowableClassName(), out);
    writeStr(getThrowableMessage(), out);
}

From source file:org.apache.openjpa.datacache.QueryKey.java

public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(_candidateClassName);
    out.writeBoolean(_subclasses);//w w  w. ja  va2  s  . com
    out.writeObject(_accessPathClassNames);
    out.writeObject(_query);
    out.writeBoolean(_ignoreChanges);
    out.writeObject(_params);
    out.writeLong(_rangeStart);
    out.writeLong(_rangeEnd);
    out.writeInt(_timeout);
}

From source file:com.eaio.util.text.HumanTime.java

/**
 * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
 *///from   www. jav a  2  s  . co m
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeLong(delta);
}

From source file:gridool.db.partitioning.phihash.monetdb.MonetDBCsvLoadOperation.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    IOUtils.writeString(tableName, out);
    GridNode masterNode = getMasterNode();
    if (masterNode == null) {
        IOUtils.writeString(csvFileName, out);
    } else {/*  w w w  .j ava  2s  .c  o  m*/
        String altered = GridUtils.alterFileName(csvFileName, masterNode);
        IOUtils.writeString(altered, out);
    }
    IOUtils.writeString(createTableDDL, out);
    IOUtils.writeString(copyIntoQuery, out);
    out.writeLong(expectedNumRecords);
    IOUtils.writeString(alterTableDDL, out);
}

From source file:com.splicemachine.derby.stream.output.insert.InsertTableWriterBuilder.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    try {//www . jav a2s  . c o  m
        out.writeBoolean(isUpsert);
        out.writeBoolean(operationContext != null);
        if (operationContext != null)
            out.writeObject(operationContext);
        SIDriver.driver().getOperationFactory().writeTxn(txn, out);
        ArrayUtil.writeIntArray(out, pkCols);
        out.writeUTF(tableVersion);
        ArrayUtil.writeIntArray(out, execRowTypeFormatIds);
        out.writeObject(execRowDefinition);
        out.writeInt(autoIncrementRowLocationArray.length);
        for (int i = 0; i < autoIncrementRowLocationArray.length; i++)
            out.writeObject(autoIncrementRowLocationArray[i]);
        out.writeInt(spliceSequences.length);
        for (int i = 0; i < spliceSequences.length; i++) {
            out.writeObject(spliceSequences[i]);
        }
        out.writeLong(heapConglom);
    } catch (Exception e) {
        throw new IOException(e);
    }

}

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

public void writeExternal(final ObjectOutput out) throws IOException {
    nullMask |= (getName() == null) ? NAME : 0;
    nullMask |= (getValue() == null) ? VALUE : 0;
    nullMask |= (getComment() == null) ? COMMENT : 0;
    nullMask |= (getCommentURL() == null) ? COMMENT_URL : 0;
    nullMask |= (getExpiryDate() == null) ? EXPIRY_DATE : 0;
    nullMask |= (getDomain() == null) ? DOMAIN : 0;
    nullMask |= (getPath() == null) ? PATH : 0;
    nullMask |= (getPorts() == null) ? PORTS : 0;

    out.writeInt(nullMask);//from  w ww . j  av a  2 s .  com

    if ((nullMask & NAME) == 0)
        out.writeUTF(getName());

    if ((nullMask & VALUE) == 0)
        out.writeUTF(getValue());

    if ((nullMask & COMMENT) == 0)
        out.writeUTF(getComment());

    if ((nullMask & COMMENT_URL) == 0)
        out.writeUTF(getCommentURL());

    if ((nullMask & EXPIRY_DATE) == 0)
        out.writeLong(getExpiryDate().getTime());

    out.writeBoolean(isPersistent());

    if ((nullMask & DOMAIN) == 0)
        out.writeUTF(getDomain());

    if ((nullMask & PATH) == 0)
        out.writeUTF(getPath());

    if ((nullMask & PORTS) == 0) {
        out.writeInt(getPorts().length);
        for (int p : getPorts())
            out.writeInt(p);
    }

    out.writeBoolean(isSecure());
    out.writeInt(getVersion());
}

From source file:com.weibo.api.motan.protocol.rpc.CompressRpcCodec.java

/**
 * response body ?//from   ww  w . j  av  a2s .c  om
 * 
 * <pre>
* 
* body:
* 
*     byte[] :  serialize (result) or serialize (exception)
* 
* </pre>
 *
 * @param channel
 * @param value
 * @return
 * @throws IOException
 */
private byte[] encodeResponse(Channel channel, Response value) throws IOException {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    ObjectOutput output = createOutput(outputStream);
    Serialization serialization = ExtensionLoader.getExtensionLoader(Serialization.class).getExtension(
            channel.getUrl().getParameter(URLParamType.serialize.getName(), URLParamType.serialize.getValue()));

    byte flag = 0;

    output.writeLong(value.getProcessTime());

    if (value.getException() != null) {
        output.writeUTF(value.getException().getClass().getName());
        serialize(output, value.getException(), serialization);
        flag = MotanConstants.FLAG_RESPONSE_EXCEPTION;
    } else if (value.getValue() == null) {
        flag = MotanConstants.FLAG_RESPONSE_VOID;
    } else {
        output.writeUTF(value.getValue().getClass().getName());
        serialize(output, value.getValue(), serialization);
        // v2?responseattachment
        Map<String, String> attachments = value.getAttachments();
        if (attachments != null) {
            String signed = attachments.get(ATTACHMENT_SIGN);
            String unSigned = attachments.get(UN_ATTACHMENT_SIGN);
            attachments.clear(); // attachment????

            if (StringUtils.isNotBlank(signed)) {
                attachments.put(ATTACHMENT_SIGN, signed);
            }
            if (StringUtils.isNotBlank(unSigned)) {
                attachments.put(UN_ATTACHMENT_SIGN, unSigned);
            }
        }
        if (attachments != null && !attachments.isEmpty()) {// ??
            addAttachment(output, attachments);
        } else {
            // empty attachments
            output.writeShort(0);
        }
        flag = MotanConstants.FLAG_RESPONSE_ATTACHMENT; // v2flag
    }

    output.flush();

    byte[] body = outputStream.toByteArray();

    output.close();
    Boolean usegz = channel.getUrl().getBooleanParameter(URLParamType.usegz.getName(),
            URLParamType.usegz.getBooleanValue());
    int minGzSize = channel.getUrl().getIntParameter(URLParamType.mingzSize.getName(),
            URLParamType.mingzSize.getIntValue());
    return encode(compress(body, usegz, minGzSize), flag, value.getRequestId());
}

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

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(template);/*from   www .  j  a v  a 2  s.c o m*/
    writeScan(out);
    out.writeBoolean(rowColumnMap != null);
    if (rowColumnMap != null) {
        out.writeInt(rowColumnMap.length);
        //noinspection ForLoopReplaceableByForEach
        for (int i = 0; i < rowColumnMap.length; ++i) {
            out.writeInt(rowColumnMap[i]);
        }
    }
    writeTxn(out);
    ArrayUtil.writeIntArray(out, keyColumnEncodingOrder);
    out.writeBoolean(keyColumnSortOrder != null);
    if (keyColumnSortOrder != null) {
        ArrayUtil.writeBooleanArray(out, keyColumnSortOrder);
    }
    ArrayUtil.writeIntArray(out, keyColumnTypes);
    out.writeBoolean(keyDecodingMap != null);
    if (keyDecodingMap != null) {
        ArrayUtil.writeIntArray(out, keyDecodingMap);
    }
    out.writeBoolean(baseColumnMap != null);
    if (baseColumnMap != null) {
        ArrayUtil.writeIntArray(out, baseColumnMap);
    }
    out.writeObject(accessedKeys);
    out.writeBoolean(reuseRowLocation);
    out.writeBoolean(oneSplitPerRegion);
    out.writeBoolean(indexName != null);
    if (indexName != null)
        out.writeUTF(indexName);
    out.writeBoolean(tableVersion != null);
    if (tableVersion != null)
        out.writeUTF(tableVersion);

    out.writeBoolean(fieldLengths != null);
    if (fieldLengths != null) {
        out.writeInt(fieldLengths.length);
        //noinspection ForLoopReplaceableByForEach
        for (int i = 0; i < fieldLengths.length; ++i) {
            out.writeInt(fieldLengths[i]);
        }
        out.writeInt(columnPositionMap.length);
        //noinspection ForLoopReplaceableByForEach
        for (int i = 0; i < columnPositionMap.length; ++i) {
            out.writeInt(columnPositionMap[i]);
        }
        out.writeLong(baseTableConglomId);
    }
    out.writeLong(demarcationPoint);
    out.writeBoolean(optionalProbeValue != null);
    if (optionalProbeValue != null)
        out.writeObject(optionalProbeValue);
    out.writeBoolean(pin);
    writeNullableString(delimited, out);
    writeNullableString(escaped, out);
    writeNullableString(lines, out);
    writeNullableString(storedAs, out);
    writeNullableString(location, out);
}