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

The following examples show how to use java.io.ObjectOutput#writeBoolean() . 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: GridCacheQueueHeader.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    U.writeIgniteUuid(out, id);
    out.writeInt(cap);
    out.writeBoolean(collocated);
    out.writeLong(head);
    out.writeLong(tail);
    out.writeBoolean(rmvIdxs != null);

    if (rmvIdxs != null) {
        out.writeInt(rmvIdxs.size());

        for (Long idx : rmvIdxs)
            out.writeLong(idx);
    }
}
 
Example 2
Source File: TypeDeclaration.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject( typeName );
    out.writeObject( role );
    out.writeObject( format );
    out.writeObject( kind );
    out.writeObject( nature );
    out.writeObject( durationAttribute );
    out.writeObject( timestampAttribute );
    out.writeObject( typeClassName );
    out.writeObject( typeTemplate );
    out.writeObject( typeClassDef );
    out.writeObject( durationExtractor );
    out.writeObject( timestampExtractor );
    out.writeObject( resource );
    out.writeLong(expirationOffset);
    out.writeObject( expirationPolicy );
    out.writeBoolean(dynamic);
    out.writeBoolean( typesafe );
    out.writeBoolean(propertyReactive);
    out.writeBoolean(valid);
}
 
Example 3
Source File: HAWriteMessage.java    From database with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
	super.writeExternal(out);
       if (currentVersion >= VERSION1 && uuid != null) {
           out.write(currentVersion);
           if (currentVersion >= VERSION2) {
               out.writeBoolean(compressorKey == null);
               if (compressorKey != null)
                   out.writeUTF(compressorKey);
           }
           out.writeLong(uuid.getMostSignificantBits());
           out.writeLong(uuid.getLeastSignificantBits());
       } else {
           // Note: Replay of an older log message.
           out.write(VERSION0);
       }
	out.writeByte(storeType.getType());
	out.writeLong(commitCounter);
	out.writeLong(lastCommitTime);
	out.writeLong(sequence);
	out.writeLong(quorumToken);
       if (currentVersion >= VERSION3)
           out.writeInt(replicationFactor);
	out.writeLong(fileExtent);
	out.writeLong(firstOffset);
}
 
Example 4
Source File: AggregatorInfo.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Write this object out
 *
 * @param out write bytes here
 *
	 * @exception IOException thrown on error
 */
public void writeExternal(ObjectOutput out) throws IOException
{
	out.writeObject(aggregateName);
	out.writeInt(inputColumn);
	out.writeInt(outputColumn);
	out.writeInt(aggregatorColumn);
	out.writeObject(aggregatorClassName);
	out.writeBoolean(isDistinct);
	out.writeObject(rd);
}
 
Example 5
Source File: AggregatorInfo.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Write this object out
 *
 * @param out write bytes here
 *
 * @exception IOException thrown on error
 */
public void writeExternal(ObjectOutput out) throws IOException
{
    out.writeObject(aggregateName);
    out.writeInt(inputColumn);
    out.writeInt(outputColumn);
    out.writeInt(aggregatorColumn);
    out.writeObject(aggregatorClassName);
    if (aggregatorClassName.equals(ClassName.StringAggregator)) {
        out.writeObject(param);
    }
    out.writeBoolean(isDistinct);
    out.writeObject(rd);
}
 
Example 6
Source File: IntervalTreeNode.java    From brein-time-utilities with Apache License 2.0 5 votes vote down vote up
protected void writeChild(final ObjectOutput out,
                          final IntervalTreeNodeChildType type) throws IOException {
    if (hasChild(type)) {
        out.writeBoolean(true);
        getChild(type).writeExternal(out);
    } else {
        out.writeBoolean(false);
    }
}
 
Example 7
Source File: NordsieckStepInterpolator.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeExternal(final ObjectOutput out)
    throws IOException {

    // save the state of the base class
    writeBaseExternal(out);

    // save the local attributes
    out.writeDouble(scalingH);
    out.writeDouble(referenceTime);

    final int n = (currentState == null) ? -1 : currentState.length;
    if (scaled == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        for (int j = 0; j < n; ++j) {
            out.writeDouble(scaled[j]);
        }
    }

    if (nordsieck == null) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        out.writeObject(nordsieck);
    }

    // we don't save state variation, it will be recomputed

}
 
Example 8
Source File: OptimizedMarshallerTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeBoolean(false);
    out.writeBoolean(false);
    out.writeBoolean(false);
    out.writeBoolean(false);
    out.writeBoolean(false);
    out.writeBoolean(false);
}
 
Example 9
Source File: TypeDescriptorImpl.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Write this object to a stream of stored objects.
 *
 * @param out write bytes here.
 *
 * @exception IOException		thrown on error
 */
public void writeExternal( ObjectOutput out )
	 throws IOException
{
	out.writeObject( typeId );
	out.writeInt( precision );

	//Scale does not apply to character data types. Starting 10.3 release,
	//the scale field in TypeDescriptor in SYSCOLUMNS will be used to save
	//the collation type of the character data types. Because of this, in
	//this method, we check if we are dealing with character types. If yes,
	//then write the collation type into the on-disk scale field of 
	//TypeDescriptor. But if we are dealing with non-character data types,
	//then write the scale of that data type into the on-disk scale field
	//of TypeDescriptor. In other words, the on-disk scale field has 2 
	//different meanings depending on what kind of data type we are dealing 
	//with. For character data types, it really represents the collation 
	//type of the character data type. For all the other data types, it 
	//represents the scale of that data type.
	switch (typeId.getJDBCTypeId()) {
	case Types.CHAR:
	case Types.VARCHAR:
	case Types.LONGVARCHAR:
	case Types.CLOB:
		out.writeInt( collationType );
		break;
	default:
		out.writeInt( scale );
		break;
	}		
	
	out.writeBoolean( isNullable );
	out.writeInt( maximumWidth );
}
 
Example 10
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 11
Source File: ClassAwareObjectStore.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(storesMap);
    out.writeObject(concreteStores);
    out.writeObject(equalityMap);
    out.writeInt(size);
    out.writeBoolean(isEqualityBehaviour);
    out.writeObject(lock);
}
 
Example 12
Source File: SQLBoolean.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {

		// never called when value is null
		if (SanityManager.DEBUG)
			SanityManager.ASSERT(! isNull());

		out.writeBoolean(value);
	}
 
Example 13
Source File: LeftInputAdapterNode.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeObject(objectSource);
    out.writeBoolean(leftTupleMemoryEnabled);
    out.writeObject(sinkMask);
}
 
Example 14
Source File: EJBMetaDataImpl.java    From tomee with Apache License 2.0 4 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(3);

    out.writeObject(homeClass);
    out.writeObject(remoteClass);
    out.writeObject(keyClass);
    out.writeObject(ejbHomeProxy);
    out.writeByte(type);
    out.writeUTF(deploymentID);
    out.writeShort((short) deploymentCode);
    out.writeShort((short) businessClasses.size());
    for (final Class clazz : businessClasses) {
        out.writeObject(clazz);
    }
    if (businessClasses.size() > 0) {
        out.writeObject(primaryKey);
    }
    out.writeObject(mainInterface);

    out.writeByte(interfaceType.ordinal());

    out.writeInt(asynchronousMethods.size());
    for (final String asynchronousMethod : asynchronousMethods) {
        out.writeObject(asynchronousMethod);
    }

    if (properties.size() == 0) {
        out.writeBoolean(false);
    } else {
        out.writeBoolean(true);
        final ByteArrayOutputStream tmp = new ByteArrayOutputStream();
        properties.store(tmp, "");
        tmp.close();
        final byte[] bytes = tmp.toByteArray();
        final int length = bytes.length;
        out.writeInt(length);
        out.write(bytes);
    }

}
 
Example 15
Source File: TableScannerBuilder.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException{
        out.writeObject(template);
        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.writeByteArray(out, token);
        ArrayUtil.writeIntArray(out,keyColumnEncodingOrder);
        ArrayUtil.writeIntArray(out,partitionByColumns);

        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);
        out.writeBoolean(useSample);
        out.writeDouble(sampleFraction);
        out.writeBoolean(defaultRow != null);
        if (defaultRow != null)
            out.writeObject(defaultRow);
        out.writeBoolean(defaultValueMap != null);
        if (defaultValueMap != null)
            out.writeObject(defaultValueMap);
        out.writeBoolean(ignoreRecentTransactions);
}
 
Example 16
Source File: LiveRef.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void write(ObjectOutput out, boolean useNewFormat)
    throws IOException
{
    boolean isResultStream = false;
    if (out instanceof ConnectionOutputStream) {
        ConnectionOutputStream stream = (ConnectionOutputStream) out;
        isResultStream = stream.isResultStream();
        /*
         * Ensure that referential integrity is not broken while
         * this LiveRef is in transit.  If it is being marshalled
         * as part of a result, it may not otherwise be strongly
         * reachable after the remote call has completed; even if
         * it is being marshalled as part of an argument, the VM
         * may determine that the reference on the stack is no
         * longer reachable after marshalling (see 6181943)--
         * therefore, tell the stream to save a reference until a
         * timeout expires or, for results, a DGCAck message has
         * been received from the caller, or for arguments, the
         * remote call has completed.  For a "local" LiveRef, save
         * a reference to the impl directly, because the impl is
         * not reachable from the LiveRef (see 4114579);
         * otherwise, save a reference to the LiveRef, for the
         * client-side DGC to watch over.  (Also see 4017232.)
         */
        if (isLocal) {
            ObjectEndpoint oe =
                new ObjectEndpoint(id, ep.getInboundTransport());
            Target target = ObjectTable.getTarget(oe);

            if (target != null) {
                Remote impl = target.getImpl();
                if (impl != null) {
                    stream.saveObject(impl);
                }
            }
        } else {
            stream.saveObject(this);
        }
    }
    // All together now write out the endpoint, id, and flag

    // (need to choose whether or not to use old JDK1.1 endpoint format)
    if (useNewFormat) {
        ((TCPEndpoint) ep).write(out);
    } else {
        ((TCPEndpoint) ep).writeHostPortFormat(out);
    }
    id.write(out);
    out.writeBoolean(isResultStream);
}
 
Example 17
Source File: AbstractStepInterpolator.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** Save the base state of the instance.
 * This method performs step finalization if it has not been done
 * before.
 * @param out stream where to save the state
 * @exception IOException in case of write error
 */
protected void writeBaseExternal(final ObjectOutput out)
  throws IOException {

  if (currentState == null) {
      out.writeInt(-1);
  } else {
      out.writeInt(currentState.length);
  }
  out.writeDouble(globalPreviousTime);
  out.writeDouble(globalCurrentTime);
  out.writeDouble(softPreviousTime);
  out.writeDouble(softCurrentTime);
  out.writeDouble(h);
  out.writeBoolean(forward);
  out.writeObject(primaryMapper);
  out.write(secondaryMappers.length);
  for (final EquationsMapper  mapper : secondaryMappers) {
      out.writeObject(mapper);
  }

  if (currentState != null) {
      for (int i = 0; i < currentState.length; ++i) {
          out.writeDouble(currentState[i]);
      }
  }

  out.writeDouble(interpolatedTime);

  // we do not store the interpolated state,
  // it will be recomputed as needed after reading

  try {
      // finalize the step (and don't bother saving the now true flag)
      finalizeStep();
  } catch (MaxCountExceededException mcee) {
      final IOException ioe = new IOException(mcee.getLocalizedMessage());
      ioe.initCause(mcee);
      throw ioe;
  }

}
 
Example 18
Source File: GroupedAggregateOperation.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    out.writeBoolean(isRollup);
    out.writeObject(groupedAggregateContext);
}
 
Example 19
Source File: CountAggregator.java    From gemfirexd-oss with Apache License 2.0 3 votes vote down vote up
/** 
 * Although we are not expected to be persistent per se,
 * we may be written out by the sorter temporarily.  So
 * we need to be able to write ourselves out and read
 * ourselves back in.  
 * 
 * @exception IOException thrown on error
 */
public final void writeExternal(ObjectOutput out) throws IOException
{
	super.writeExternal(out);
	out.writeBoolean(isCountStar);
	out.writeLong(value);
}
 
Example 20
Source File: TPS.java    From database with GNU General Public License v2.0 2 votes vote down vote up
/**
     * 
     * FIXME use compression for the names and timestamps, refactoring the logic
     * already in {@link AbstractKeyArrayIndexProcedure}.
     * 
     * @todo use huffman compression for the name and timestamp dictionaries
     *       (fewer bits for the more frequent symbols, but at what added cost)?
     */
    public void writeExternal(final ObjectOutput out) throws IOException {

        // serialization version.
        out.writeShort(VERSION0);
        
        // the schema.
        out.writeObject(schema);

        out.writeLong(writeTime);
        
        /*
         * Setup bit stream.
         */
//        final OutputBitStream obs;
//        final ByteArrayOutputStream baos;
//        if(out instanceof OutputStream) {
//            baos = null;
//            obs = new OutputBitStream((OutputStream)out);
//        } else {
//            baos = new ByteArrayOutputStream();
//            obs = new OutputBitStream(baos);
//        }
        
        out.writeBoolean(preconditionOk);
        
        // #of tuples.
        out.writeInt(tuples.size());
        
        // @todo property name codec.
        
        // @todo timestamp codec.
        
        /*
         * write tuples.
         */
        
        final Iterator<ITPV> itr = tuples.values().iterator();
        
        while(itr.hasNext()) {
            
            final TPV tpv = (TPV)itr.next();
            
            out.writeUTF(tpv.name);
            
            out.writeLong(tpv.timestamp);

            final byte[] val = ValueType.encode(tpv.value);

            out.writeInt(val == null ? 0 : val.length + 1); // #of bytes + 1

            if (val != null) {

                out.write(val); // encoded value.

            }
            
        }

// obs.flush();
//        if(baos!=null) {
//            out.write(baos.toByteArray());
//        }
        
    }