下面列出了java.io.ObjectOutput#writeByte ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* 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);
}
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]);
}
}
}
@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);
}
}
}
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());
}
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
}
/**
* 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);
}
}
/**
* 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());
}
}
@Override
public void writeObject(ObjectOutput output, RootAuthenticationSessionPredicate obj) throws IOException {
output.writeByte(VERSION_1);
MarshallUtil.marshallString(obj.realm, output);
KeycloakMarshallUtil.marshall(obj.expired, output);
}
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());
}
/**
* {@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);
}
@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);
}
}
@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);
}
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);
}
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");
}
}
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeByte(topic.ordinal());
U.writeUuid(out, id1);
}
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");
}
}
@Override
public void writeExternal(ObjectOutput output) throws IOException {
output.writeLong(txnId);
output.writeLong(beginTimestamp);
output.writeByte(isolationLevel.encode());
}
public void writeExternal(ObjectOutput out) throws IOException {
out.writeByte(VERSION);
out.writeObject(ser);
ser.serialize(out, e);
}
private void writeHebrewTime(ObjectOutput out) throws IOException {
HebrewTime time = (HebrewTime) this.obj;
out.writeByte(time.getDigitalHour());
out.writeShort(time.getPart());
}
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeByte(VIETNAMESE);
this.writeVietnamese(out);
}