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

The following examples show how to use java.io.ObjectOutput#writeByte() . 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: EJBRequest.java    From tomee with Apache License 2.0 6 votes vote down vote up
/**
 * Write to server.
 * WARNING: To maintain backwards compatibility never change the order or insert new writes, always append to
 * {@link org.apache.openejb.client.EJBRequest.Body#writeExternal(java.io.ObjectOutput)}
 *
 * @param out ObjectOutput
 * @throws IOException
 */
@Override
public void writeExternal(final ObjectOutput out) throws IOException {

    out.writeByte(requestMethod.getCode());

    if (deploymentCode > 0) {
        out.writeObject(null);
    } else {
        out.writeObject(deploymentId);
    }

    out.writeShort(deploymentCode);
    out.writeObject(clientIdentity);
    out.writeInt(serverHash);
    out.flush();

    body.setMetaData(metaData);
    body.writeExternal(out);
}
 
Example 2
Source File: TCustomHashSet.java    From blip with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(1);

    // NOTE: Super was not written in version 0
    super.writeExternal(out);

    // 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]);
        }
    }
}
 
Example 3
Source File: RegressionTree.java    From incubator-hivemall with Apache License 2.0 6 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeInt(splitFeature);
    out.writeByte(quantitativeFeature ? NUMERIC : NOMINAL);
    out.writeDouble(splitValue);

    if (isLeaf()) {
        out.writeBoolean(true);
        out.writeDouble(output);
    } else {
        out.writeBoolean(false);
        if (trueChild == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            trueChild.writeExternal(out);
        }
        if (falseChild == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            falseChild.writeExternal(out);
        }
    }
}
 
Example 4
Source File: SnapshotResultsWindow.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    
    out.writeByte(PERSISTENCE_VERSION_MAJOR);
    out.writeByte(PERSISTENCE_VERSION_MINOR);
    
    out.writeUTF(Utilities.toURI(snapshot.getFile()).toString());
}
 
Example 5
Source File: GMS.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
            out.writeByte(type);
//            out.writeObject(view);
            out.writeObject(mbr);
//            out.writeObject(join_rsp);
//            out.writeObject(my_digest);
            out.writeObject(merge_id);
            out.writeBoolean(merge_rejected);
            out.writeBoolean(this.forcedOut); // GemStoneAddition
            out.writeObject(this.arg); // GemStoneAddition
        }
 
Example 6
Source File: TCPEndpoint.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Write endpoint to output stream.
 */
public void write(ObjectOutput out) throws IOException {
    if (csf == null) {
        out.writeByte(FORMAT_HOST_PORT);
        out.writeUTF(host);
        out.writeInt(port);
    } else {
        out.writeByte(FORMAT_HOST_PORT_FACTORY);
        out.writeUTF(host);
        out.writeInt(port);
        out.writeObject(csf);
    }
}
 
Example 7
Source File: MimeType.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * The object implements the writeExternal method to save its contents
 * by calling the methods of DataOutput for its primitive values or
 * calling the writeObject method of ObjectOutput for objects, strings
 * and arrays.
 * @exception IOException Includes any I/O exceptions that may occur
 */
public void writeExternal(ObjectOutput out) throws IOException {
    String s = toString(); // contains ASCII chars only
    // one-to-one correspondence between ASCII char and byte in UTF string
    if (s.length() <= 65535) { // 65535 is max length of UTF string
        out.writeUTF(s);
    } else {
        out.writeByte(0);
        out.writeByte(0);
        out.writeInt(s.length());
        out.write(s.getBytes());
    }
}
 
Example 8
Source File: RootAuthenticationSessionPredicate.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public void writeObject(ObjectOutput output, RootAuthenticationSessionPredicate obj) throws IOException {
    output.writeByte(VERSION_1);

    MarshallUtil.marshallString(obj.realm, output);
    KeycloakMarshallUtil.marshall(obj.expired, output);

}
 
Example 9
Source File: PersianCalendar.java    From Time4A with Apache License 2.0 5 votes vote down vote up
private void writePersian(ObjectOutput out) throws IOException {

            PersianCalendar persian = (PersianCalendar) this.obj;
            out.writeInt(persian.getYear());
            out.writeByte(persian.getMonth().getValue());
            out.writeByte(persian.getDayOfMonth());

        }
 
Example 10
Source File: TIntDoubleHash.java    From blip with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // NO_ENTRY_KEY
    out.writeInt(no_entry_key);

    // NO_ENTRY_VALUE
    out.writeDouble(no_entry_value);
}
 
Example 11
Source File: BooleanAttribute.java    From reladomo with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeNonNullAggregateDataValue(Nullable valueWrappedInNullable, ObjectOutput out) throws IOException
{
    MutableBoolean b = (MutableBoolean) valueWrappedInNullable;
    if (b.booleanValue())
    {
        out.writeByte(TRUE_BOOLEAN_VALUE);
    }
    else
    {
        out.writeByte(FALSE_BOOLEAN_VALUE);
    }
}
 
Example 12
Source File: DataSourceMetaData.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(1);

    out.writeObject(jdbcDriver);
    out.writeObject(jdbcUrl);
    out.writeObject(defaultUserName);
    out.writeObject(defaultPassword);
}
 
Example 13
Source File: FD_SOCK.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeByte(type);
    out.writeObject(mbr);
    out.writeObject(sock_addr);
    out.writeObject(cachedAddrs);
    out.writeObject(mbrs);
    out.writeBoolean(this.abnormalTermination);
}
 
Example 14
Source File: Ser.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void writeInternal(byte type, Object object, ObjectOutput out) throws IOException {
    out.writeByte(type);
    switch (type) {
        case DURATION_TYPE:
            ((Duration) object).writeExternal(out);
            break;
        case INSTANT_TYPE:
            ((Instant) object).writeExternal(out);
            break;
        case LOCAL_DATE_TYPE:
            ((LocalDate) object).writeExternal(out);
            break;
        case LOCAL_DATE_TIME_TYPE:
            ((LocalDateTime) object).writeExternal(out);
            break;
        case LOCAL_TIME_TYPE:
            ((LocalTime) object).writeExternal(out);
            break;
        case ZONE_REGION_TYPE:
            ((ZoneRegion) object).writeExternal(out);
            break;
        case ZONE_OFFSET_TYPE:
            ((ZoneOffset) object).writeExternal(out);
            break;
        case ZONE_DATE_TIME_TYPE:
            ((ZonedDateTime) object).writeExternal(out);
            break;
        case OFFSET_TIME_TYPE:
            ((OffsetTime) object).writeExternal(out);
            break;
        case OFFSET_DATE_TIME_TYPE:
            ((OffsetDateTime) object).writeExternal(out);
            break;
        case YEAR_TYPE:
            ((Year) object).writeExternal(out);
            break;
        case YEAR_MONTH_TYPE:
            ((YearMonth) object).writeExternal(out);
            break;
        case MONTH_DAY_TYPE:
            ((MonthDay) object).writeExternal(out);
            break;
        case PERIOD_TYPE:
            ((Period) object).writeExternal(out);
            break;
        default:
            throw new InvalidClassException("Unknown serialized type");
    }
}
 
Example 15
Source File: GridTopic.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
    out.writeByte(topic.ordinal());
    U.writeUuid(out, id1);
}
 
Example 16
Source File: Ser.java    From j2objc with Apache License 2.0 4 votes vote down vote up
static void writeInternal(byte type, Object object, ObjectOutput out) throws IOException {
    out.writeByte(type);
    switch (type) {
        case DURATION_TYPE:
            ((Duration) object).writeExternal(out);
            break;
        case INSTANT_TYPE:
            ((Instant) object).writeExternal(out);
            break;
        case LOCAL_DATE_TYPE:
            ((LocalDate) object).writeExternal(out);
            break;
        case LOCAL_DATE_TIME_TYPE:
            ((LocalDateTime) object).writeExternal(out);
            break;
        case LOCAL_TIME_TYPE:
            ((LocalTime) object).writeExternal(out);
            break;
        case ZONE_REGION_TYPE:
            ((ZoneRegion) object).writeExternal(out);
            break;
        case ZONE_OFFSET_TYPE:
            ((ZoneOffset) object).writeExternal(out);
            break;
        case ZONE_DATE_TIME_TYPE:
            ((ZonedDateTime) object).writeExternal(out);
            break;
        case OFFSET_TIME_TYPE:
            ((OffsetTime) object).writeExternal(out);
            break;
        case OFFSET_DATE_TIME_TYPE:
            ((OffsetDateTime) object).writeExternal(out);
            break;
        case YEAR_TYPE:
            ((Year) object).writeExternal(out);
            break;
        case YEAR_MONTH_TYPE:
            ((YearMonth) object).writeExternal(out);
            break;
        case MONTH_DAY_TYPE:
            ((MonthDay) object).writeExternal(out);
            break;
        case PERIOD_TYPE:
            ((Period) object).writeExternal(out);
            break;
        default:
            throw new InvalidClassException("Unknown serialized type");
    }
}
 
Example 17
Source File: AbstractTxnView.java    From spliceengine with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void writeExternal(ObjectOutput output) throws IOException {
   	output.writeLong(txnId);
   	output.writeLong(beginTimestamp);
   	output.writeByte(isolationLevel.encode());    			
}
 
Example 18
Source File: RemoteAsynchronousIteratorImpl.java    From database with GNU General Public License v2.0 3 votes vote down vote up
public void writeExternal(ObjectOutput out) throws IOException {

            out.writeByte(VERSION);
            
            out.writeObject(ser);
            
            ser.serialize(out, e);
            
        }
 
Example 19
Source File: HebrewTime.java    From Time4A with Apache License 2.0 3 votes vote down vote up
private void writeHebrewTime(ObjectOutput out) throws IOException {

            HebrewTime time = (HebrewTime) this.obj;
            out.writeByte(time.getDigitalHour());
            out.writeShort(time.getPart());

        }
 
Example 20
Source File: VietnameseCalendar.java    From Time4A with Apache License 2.0 3 votes vote down vote up
@Override
public void writeExternal(ObjectOutput out) throws IOException {

    out.writeByte(VIETNAMESE);
    this.writeVietnamese(out);

}