Java Code Examples for java.io.ObjectOutput#writeShort()

The following examples show how to use java.io.ObjectOutput#writeShort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseVocabulary.java    From database with GNU General Public License v2.0 6 votes vote down vote up
public void writeExternal(final ObjectOutput out) throws IOException {

        if (val2iv == null)
            throw new IllegalStateException();
        if (iv2val == null)
            throw new IllegalStateException();

        out.writeShort(currentVersion);

        switch (currentVersion) {
//        case VERSION0:
//            writeVersion0(out);
//            break;
//        case VERSION1:
//            writeVersion1(out);
//            break;
        case VERSION2:
            writeVersion2(out);
            break;
        default:
            throw new AssertionError();
        }
    
    }
 
Example 2
Source File: XML.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Write an XML value. 
 * @param out The stream to which we're writing.
 */
public void writeExternal(ObjectOutput out) throws IOException
{
    // never called when value is null
    if (SanityManager.DEBUG)
        SanityManager.ASSERT(!isNull());

    // Write out the XML store impl id.
    out.writeShort(UTF8_IMPL_ID);

    // Now write out the data.
    xmlStringValue.writeExternal(out);
}
 
Example 3
Source File: XML.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Write an XML value. 
 * @param out The stream to which we're writing.
 */
public void writeExternal(ObjectOutput out) throws IOException
{
    // never called when value is null
    if (SanityManager.DEBUG)
        SanityManager.ASSERT(!isNull());

    // Write out the XML store impl id.
    out.writeShort(UTF8_IMPL_ID);

    // Now write out the data.
    xmlStringValue.writeExternal(out);
}
 
Example 4
Source File: ExternObjTrees.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(z);
    out.writeByte(b);
    out.writeChar(c);
    out.writeShort(s);
    out.writeInt(i);
    out.writeFloat(f);
    out.writeLong(j);
    out.writeDouble(d);
    out.writeObject(str);
    out.writeObject(parent);
    out.writeObject(left);
    out.writeObject(right);
}
 
Example 5
Source File: left_IrmiPRODelegate_1.2.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
public void send(byte code, ObjectOutput out) throws IOException {
    JClientRequestInfo info = new JRMPClientRequestInfoImpl();
    for (int i = 0; i < cis.length; i++) {
        cis[i].send_request(info);
    }
    Collection c = info.get_all_request_service_context();
    out.writeShort(c.size());
    for (Iterator it = c.iterator(); it.hasNext(); ) {
        out.writeObject(it.next());
    }
}
 
Example 6
Source File: SPX.java    From Time4A with Apache License 2.0 5 votes vote down vote up
private void writeFrenchRev(ObjectOutput out)
    throws IOException {

    FrenchRepublicanCalendar cal = (FrenchRepublicanCalendar) this.obj;
    out.writeInt(cal.getYear());
    out.writeShort(cal.getDayOfYear());

}
 
Example 7
Source File: EJBHomeProxyHandle.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
    // write out the version of the serialized data for future use
    out.writeByte(2);

    final boolean hasExec = handler.executor != null && handler.executor != JNDIContext.globalExecutor();
    out.writeBoolean(hasExec);
    if (hasExec) {
        out.writeInt(handler.executor.getMaximumPoolSize());
        final BlockingQueue<Runnable> queue = handler.executor.getQueue();
        out.writeInt(queue.size() + queue.remainingCapacity());
    }

    handler.client.setMetaData(metaData);
    handler.client.writeExternal(out);

    final EJBMetaDataImpl ejb = handler.ejb;
    out.writeObject(ejb.homeClass);
    out.writeObject(ejb.remoteClass);
    out.writeObject(ejb.keyClass);
    out.writeByte(ejb.type);
    out.writeUTF(ejb.deploymentID);
    out.writeShort(ejb.deploymentCode);

    handler.server.setMetaData(metaData);
    handler.server.writeExternal(out);
    ///        out.writeObject( handler.primaryKey );
}
 
Example 8
Source File: MappeableArrayContainer.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
  out.write(this.cardinality & 0xFF);
  out.write((this.cardinality >>> 8) & 0xFF);
  if (BufferUtil.isBackedBySimpleArray(content)) {
    char[] a = content.array();
    for (int k = 0; k < this.cardinality; ++k) {
      out.writeShort(Character.reverseBytes(a[k]));
    }
  } else {
    for (int k = 0; k < this.cardinality; ++k) {
      out.writeShort(Character.reverseBytes(content.get(k)));
    }
  }
}
 
Example 9
Source File: TraitField.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void writeExternal( ObjectOutput out ) throws IOException {
    out.writeObject( value );
    out.writeBoolean( isExplicitlySet );
    out.writeBoolean( explicitSetEnabled );

    out.writeObject( rangeTypes );

    out.writeObject( defaultValuesByTraits );
    out.writeObject( defaultValueByClass );

    out.writeShort( position );
}
 
Example 10
Source File: MethodCall.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    if(method_name != null) {
        out.writeBoolean(true);
        out.writeUTF(method_name);
    }
    else {
        out.writeBoolean(false);
        out.writeShort(method_id);
    }
    out.writeObject(args);
    out.writeShort(mode);

    switch(mode) {
    case OLD:
        break;
    case METHOD:
        out.writeObject(method.getParameterTypes());
        out.writeObject(method.getDeclaringClass());
        break;
    case TYPES:
        out.writeObject(types);
        break;
    case SIGNATURE:
        out.writeObject(signature);
        break;
    case ID:
        break;
    default:
        if(log.isErrorEnabled()) log.error(ExternalStrings.MethodCall_MODE__0__IS_INVALID, mode);
        break;
    }

    if(payload != null) {
        out.writeBoolean(true);
        out.writeObject(payload);
    }
    else {
        out.writeBoolean(false);
    }
}
 
Example 11
Source File: right_IrmiPRODelegate_1.3.java    From gumtree-spoon-ast-diff with Apache License 2.0 5 votes vote down vote up
public void send(byte code, ObjectOutput out) throws IOException {
    JClientRequestInfo info = new JRMPClientRequestInfoImpl();
    for (int i = 0; i < cis.length; i++) {
        cis[i].send_request(info);
    }
    Collection c = info.get_all_request_service_context();
    out.writeShort(c.size());
    for (Iterator it = c.iterator(); it.hasNext(); ) {
        out.writeObject(it.next());
    }
}
 
Example 12
Source File: ConstraintContext.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
    short len = (short) (messageArgs == null ? 0 : messageArgs.length);
    objectOutput.writeShort(len);
    for (int i = 0; i < len; i++) {
        objectOutput.writeUTF(messageArgs[i]);
    }
}
 
Example 13
Source File: UnicastRef.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Marshal value to an ObjectOutput sink using RMI's serialization
 * format for parameters or return values.
 */
protected static void marshalValue(Class<?> type, Object value,
                                   ObjectOutput out)
    throws IOException
{
    if (type.isPrimitive()) {
        if (type == int.class) {
            out.writeInt(((Integer) value).intValue());
        } else if (type == boolean.class) {
            out.writeBoolean(((Boolean) value).booleanValue());
        } else if (type == byte.class) {
            out.writeByte(((Byte) value).byteValue());
        } else if (type == char.class) {
            out.writeChar(((Character) value).charValue());
        } else if (type == short.class) {
            out.writeShort(((Short) value).shortValue());
        } else if (type == long.class) {
            out.writeLong(((Long) value).longValue());
        } else if (type == float.class) {
            out.writeFloat(((Float) value).floatValue());
        } else if (type == double.class) {
            out.writeDouble(((Double) value).doubleValue());
        } else {
            throw new Error("Unrecognized primitive type: " + type);
        }
    } else {
        out.writeObject(value);
    }
}
 
Example 14
Source File: MappeableRunContainer.java    From RoaringBitmap with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
  out.writeShort(Character.reverseBytes((char) this.nbrruns));
  for (int k = 0; k < 2 * this.nbrruns; ++k) {
    out.writeShort(Character.reverseBytes(this.valueslength.get(k)));
  }
}
 
Example 15
Source File: BooleanDimEnc.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeShort(fixedLen);
}
 
Example 16
Source File: ShortAttribute.java    From reladomo with Apache License 2.0 4 votes vote down vote up
@Override
protected void serializedNonNullValue(T o, ObjectOutput out) throws IOException
{
    out.writeShort(this.shortValueOf(o));
}
 
Example 17
Source File: ShortAttribute.java    From reladomo with Apache License 2.0 4 votes vote down vote up
@Override
public void serializeNonNullAggregateDataValue(Nullable valueWrappedInNullable, ObjectOutput out) throws IOException
{
    out.writeShort(((MutableNumber)valueWrappedInNullable).shortValue());
}
 
Example 18
Source File: IntegerDimEnc.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeShort(fixedLen);
}
 
Example 19
Source File: ASTRealVector.java    From symja_android_library with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
	objectOutput.writeShort(fEvalFlags);
	objectOutput.writeObject(vector);
}
 
Example 20
Source File: Checkpoint.java    From database with GNU General Public License v2.0 2 votes vote down vote up
@Override
   public void writeExternal(final ObjectOutput out) throws IOException {

       out.writeInt(currentVersion);

       out.writeLong(addrMetadata);

       out.writeLong(addrRoot);
       
       out.writeLong(addrBloomFilter);

       out.writeInt(height);

	if (currentVersion <= VERSION1) {

		if (nnodes > Integer.MAX_VALUE)
			throw new RuntimeException();
		if (nleaves > Integer.MAX_VALUE)
			throw new RuntimeException();
		if (nentries > Integer.MAX_VALUE)
			throw new RuntimeException();
		
		out.writeInt((int)nnodes);

		out.writeInt((int)nleaves);

		out.writeInt((int)nentries);

	} else {

		out.writeLong(nnodes);

		out.writeLong(nleaves);

		out.writeLong(nentries);

		out.writeLong(recordVersion);

	}

       out.writeLong(counter);

       /*
        * 8 bytes follow. 
        */
       
       out.writeShort(indexType.getCode());
	out.writeShort(0/* unused */);
	out.writeInt(0/* unused */);

	/*
	 * 8 bytes follow.
	 */

	out.writeLong(0L/* unused */);

	/*
	 * Additional space added in VERSION2.
	 */
	for (int i = 0; i < 10; i++) {

		out.writeLong(0L/* unused */);

	}
	
}