下面列出了java.io.ObjectInput#readByte ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void readExternal(final ObjectInput in) throws IOException,
ClassNotFoundException {
final byte version = in.readByte();
switch(version) {
case VERSION0:
break;
default:
throw new IOException();
}
keysCoder = (IRabaCoder) in.readObject();
valsCoder = (IRabaCoder) in.readObject();
}
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
final byte version = in.readByte();
final boolean readServer = in.readBoolean();
if (readServer) {
server = new ServerMetaData();
server.setMetaData(metaData);
server.readExternal(in);
}
responseCode = in.readByte();
result = in.readObject();
if (version >= 2) {
final byte size = in.readByte();
for (int i = 0; (i < size && i < timesLength); i++) {
times[i] = in.readLong();
}
}
}
/**
@see java.io.Externalizable#readExternal
@exception IOException thrown on error
@exception ClassNotFoundException thrown on error
*/
public void readExternal( ObjectInput in )
throws IOException, ClassNotFoundException
{
byte frozenCategory = in.readByte();
switch ( frozenCategory )
{
case SQLTYPE:
initialize( (DataTypeDescriptor) in.readObject() );
break;
case JAVA_CLASS:
initialize( (String) in.readObject() );
break;
case JAVA_PRIMITIVE:
initialize( in.readByte() );
break;
}
}
@Override
public void readExternal(final ObjectInput in) throws IOException,
ClassNotFoundException {
super.readExternal(in);
final byte version = in.readByte();
switch (version) {
case VERSION0:
break;
default:
throw new UnsupportedOperationException("Unknown version: "
+ version);
}
}
@Override
public InitializerState readObject(ObjectInput input) throws IOException, ClassNotFoundException {
switch (input.readByte()) {
case VERSION_1:
return readObjectVersion1(input);
default:
throw new IOException("Unknown version");
}
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
byte header = in.readByte();
switch (header) {
case THAI_SOLAR:
this.obj = this.readThaiSolar(in);
break;
default:
throw new InvalidObjectException("Unknown calendar type.");
}
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
int nrStudents = in.readInt();
iStudentIds.clear();
for (int i = 0; i < nrStudents; i++)
iStudentIds.add(in.readLong());
iLimit = in.readInt();
if (iLimit == -2) iLimit = null;
if (getType() == XReservationType.IndividualOverride) {
switch (in.readByte()) {
case 0:
iExpired = false; break;
case 1:
iExpired = true; break;
default:
iExpired = null; break;
}
iOverride = in.readBoolean();
} else {
iExpired = null;
iOverride = false;
}
switch (in.readByte()) {
case 0:
iBreakLinkedSections = false; break;
case 1:
iBreakLinkedSections = true; break;
default:
iBreakLinkedSections = null; break;
}
}
@Override
public AuthenticationSessionEntity readObject(ObjectInput input) throws IOException, ClassNotFoundException {
switch (input.readByte()) {
case VERSION_1:
return readObjectVersion1(input);
default:
throw new IOException("Unknown version");
}
}
@Override
public PolicyRemovedEvent readObject(ObjectInput input) throws IOException, ClassNotFoundException {
switch (input.readByte()) {
case VERSION_1:
return readObjectVersion1(input);
default:
throw new IOException("Unknown version");
}
}
@Override
public RootAuthenticationSessionPredicate readObject(ObjectInput input) throws IOException, ClassNotFoundException {
switch (input.readByte()) {
case VERSION_1:
return readObjectVersion1(input);
default:
throw new IOException("Unknown version");
}
}
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
final byte version = in.readByte();
locations = (URI[]) in.readObject();
location = locations[0];
}
/**
* <p>Implementation method of interface {@link Externalizable}. </p>
*
* @param in input stream
* @throws IOException in any case of IO-failures
* @throws ClassNotFoundException if class loading fails
*/
/*[deutsch]
* <p>Implementierungsmethode des Interface {@link Externalizable}. </p>
*
* @param in input stream
* @throws IOException in any case of IO-failures
* @throws ClassNotFoundException if class loading fails
*/
@Override
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
byte header = in.readByte();
switch ((header & 0xFF) >> 4) {
case FALLBACK_TIMEZONE_TYPE:
this.obj = this.readFallback(in, header);
break;
case TRANSITION_RESOLVER_TYPE:
this.obj = this.readStrategy(header);
break;
case HISTORIZED_TIMEZONE_TYPE:
this.obj = this.readZone(in, header);
break;
case ZONAL_OFFSET_TYPE:
this.obj = this.readOffset(in, header);
break;
default:
throw new StreamCorruptedException("Unknown serialized type.");
}
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
int len = in.readByte();
this.globalId = new byte[len];
in.readFully(this.globalId);
len = in.readByte();
this.branchId = new byte[len];
in.readFully(this.branchId);
}
/**
* <p>Implementation method of interface {@link Externalizable}. </p>
*
* @param in input stream
* @throws IOException in any case of IO-failures
* @throws ClassNotFoundException if class-loading fails
*/
/*[deutsch]
* <p>Implementierungsmethode des Interface {@link Externalizable}. </p>
*
* @param in input stream
* @throws IOException in any case of IO-failures
* @throws ClassNotFoundException if class-loading fails
*/
@Override
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
byte header = in.readByte();
switch ((header & 0xFF) >> 4) {
case DATE_TYPE:
this.obj = this.readDate(in, header);
break;
case TIME_TYPE:
this.obj = this.readTime(in);
break;
case WEEKMODEL_TYPE:
this.obj = this.readWeekmodel(in, header);
break;
case MOMENT_TYPE:
this.obj = this.readMoment(in, header);
break;
case MACHINE_TIME_TYPE:
this.obj = this.readMachineTime(in, header);
break;
case DURATION_TYPE:
this.obj = this.readDuration(in, header);
break;
case DAY_PERIOD_TYPE:
this.obj = this.readDayPeriod(in, header);
break;
case TIMESTAMP_TYPE:
this.obj = this.readTimestamp(in, header);
break;
default:
throw new StreamCorruptedException("Unknown serialized type.");
}
}
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
this.charid = in.readInt();
this.channel = in.readByte();
}
static Object read(ObjectInput in) throws IOException, ClassNotFoundException {
byte type = in.readByte();
return readInternal(type, in);
}
/**
* Implements the {@code Externalizable} interface to read the object.
* @serialData
* The streamed type and parameters defined by the type's {@code writeReplace}
* method are read and passed to the corresponding static factory for the type
* to create a new instance. That instance is returned as the de-serialized
* {@code Ser} object.
*
* <ul>
* <li><a href="../../../serialized-form.html#java.time.zone.ZoneRules">ZoneRules</a>
* - {@code ZoneRules.of(standardTransitions, standardOffsets, savingsInstantTransitions, wallOffsets, lastRules);}
* <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransition">ZoneOffsetTransition</a>
* - {@code ZoneOffsetTransition of(LocalDateTime.ofEpochSecond(epochSecond), offsetBefore, offsetAfter);}
* <li><a href="../../../serialized-form.html#java.time.zone.ZoneOffsetTransitionRule">ZoneOffsetTransitionRule</a>
* - {@code ZoneOffsetTransitionRule.of(month, dom, dow, time, timeEndOfDay, timeDefinition, standardOffset, offsetBefore, offsetAfter);}
* </ul>
* @param in the data to read, not null
*/
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
type = in.readByte();
object = readInternal(type, in);
}
/**
* Implements the {@code Externalizable} interface to read the object.
* @serialData
*
* The streamed type and parameters defined by the type's {@code writeReplace}
* method are read and passed to the corresponding static factory for the type
* to create a new instance. That instance is returned as the de-serialized
* {@code Ser} object.
*
* <ul>
* <li><a href="../../serialized-form.html#java.time.Duration">Duration</a> - {@code Duration.ofSeconds(seconds, nanos);}
* <li><a href="../../serialized-form.html#java.time.Instant">Instant</a> - {@code Instant.ofEpochSecond(seconds, nanos);}
* <li><a href="../../serialized-form.html#java.time.LocalDate">LocalDate</a> - {@code LocalDate.of(year, month, day);}
* <li><a href="../../serialized-form.html#java.time.LocalDateTime">LocalDateTime</a> - {@code LocalDateTime.of(date, time);}
* <li><a href="../../serialized-form.html#java.time.LocalTime">LocalTime</a> - {@code LocalTime.of(hour, minute, second, nano);}
* <li><a href="../../serialized-form.html#java.time.MonthDay">MonthDay</a> - {@code MonthDay.of(month, day);}
* <li><a href="../../serialized-form.html#java.time.OffsetTime">OffsetTime</a> - {@code OffsetTime.of(time, offset);}
* <li><a href="../../serialized-form.html#java.time.OffsetDateTime">OffsetDateTime</a> - {@code OffsetDateTime.of(dateTime, offset);}
* <li><a href="../../serialized-form.html#java.time.Period">Period</a> - {@code Period.of(years, months, days);}
* <li><a href="../../serialized-form.html#java.time.Year">Year</a> - {@code Year.of(year);}
* <li><a href="../../serialized-form.html#java.time.YearMonth">YearMonth</a> - {@code YearMonth.of(year, month);}
* <li><a href="../../serialized-form.html#java.time.ZonedDateTime">ZonedDateTime</a> - {@code ZonedDateTime.ofLenient(dateTime, offset, zone);}
* <li><a href="../../serialized-form.html#java.time.ZoneId">ZoneId</a> - {@code ZoneId.of(id);}
* <li><a href="../../serialized-form.html#java.time.ZoneOffset">ZoneOffset</a> - {@code (offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900));}
* </ul>
*
* @param in the data to read, not null
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
type = in.readByte();
object = readInternal(type, in);
}
/**
* Implements the {@code Externalizable} interface to read the object.
* @serialData
*
* The streamed type and parameters defined by the type's {@code writeReplace}
* method are read and passed to the corresponding static factory for the type
* to create a new instance. That instance is returned as the de-serialized
* {@code Ser} object.
*
* <ul>
* <li><a href="../../serialized-form.html#java.time.Duration">Duration</a> - {@code Duration.ofSeconds(seconds, nanos);}
* <li><a href="../../serialized-form.html#java.time.Instant">Instant</a> - {@code Instant.ofEpochSecond(seconds, nanos);}
* <li><a href="../../serialized-form.html#java.time.LocalDate">LocalDate</a> - {@code LocalDate.of(year, month, day);}
* <li><a href="../../serialized-form.html#java.time.LocalDateTime">LocalDateTime</a> - {@code LocalDateTime.of(date, time);}
* <li><a href="../../serialized-form.html#java.time.LocalTime">LocalTime</a> - {@code LocalTime.of(hour, minute, second, nano);}
* <li><a href="../../serialized-form.html#java.time.MonthDay">MonthDay</a> - {@code MonthDay.of(month, day);}
* <li><a href="../../serialized-form.html#java.time.OffsetTime">OffsetTime</a> - {@code OffsetTime.of(time, offset);}
* <li><a href="../../serialized-form.html#java.time.OffsetDateTime">OffsetDateTime</a> - {@code OffsetDateTime.of(dateTime, offset);}
* <li><a href="../../serialized-form.html#java.time.Period">Period</a> - {@code Period.of(years, months, days);}
* <li><a href="../../serialized-form.html#java.time.Year">Year</a> - {@code Year.of(year);}
* <li><a href="../../serialized-form.html#java.time.YearMonth">YearMonth</a> - {@code YearMonth.of(year, month);}
* <li><a href="../../serialized-form.html#java.time.ZonedDateTime">ZonedDateTime</a> - {@code ZonedDateTime.ofLenient(dateTime, offset, zone);}
* <li><a href="../../serialized-form.html#java.time.ZoneId">ZoneId</a> - {@code ZoneId.of(id);}
* <li><a href="../../serialized-form.html#java.time.ZoneOffset">ZoneOffset</a> - {@code (offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900));}
* </ul>
*
* @param in the data to read, not null
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
type = in.readByte();
object = readInternal(type, in);
}
/**
* Implements the {@code Externalizable} interface to read the object.
* @serialData
* The streamed type and parameters defined by the type's {@code writeReplace}
* method are read and passed to the corresponding static factory for the type
* to create a new instance. That instance is returned as the de-serialized
* {@code Ser} object.
*
* <ul>
* <li><a href="../../../serialized-form.html#java.time.chrono.HijrahChronology">HijrahChronology</a> - Chronology.of(id)
* <li><a href="../../../serialized-form.html#java.time.chrono.IsoChronology">IsoChronology</a> - Chronology.of(id)
* <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseChronology">JapaneseChronology</a> - Chronology.of(id)
* <li><a href="../../../serialized-form.html#java.time.chrono.MinguoChronology">MinguoChronology</a> - Chronology.of(id)
* <li><a href="../../../serialized-form.html#java.time.chrono.ThaiBuddhistChronology">ThaiBuddhistChronology</a> - Chronology.of(id)
* <li><a href="../../../serialized-form.html#java.time.chrono.ChronoLocalDateTimeImpl">ChronoLocalDateTime</a> - date.atTime(time)
* <li><a href="../../../serialized-form.html#java.time.chrono.ChronoZonedDateTimeImpl">ChronoZonedDateTime</a> - dateTime.atZone(offset).withZoneSameLocal(zone)
* <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseDate">JapaneseDate</a> - JapaneseChronology.INSTANCE.date(year, month, dayOfMonth)
* <li><a href="../../../serialized-form.html#java.time.chrono.JapaneseEra">JapaneseEra</a> - JapaneseEra.of(eraValue)
* <li><a href="../../../serialized-form.html#java.time.chrono.HijrahDate">HijrahDate</a> - HijrahChronology chrono.date(year, month, dayOfMonth)
* <li><a href="../../../serialized-form.html#java.time.chrono.MinguoDate">MinguoDate</a> - MinguoChronology.INSTANCE.date(year, month, dayOfMonth)
* <li><a href="../../../serialized-form.html#java.time.chrono.ThaiBuddhistDate">ThaiBuddhistDate</a> - ThaiBuddhistChronology.INSTANCE.date(year, month, dayOfMonth)
* </ul>
*
* @param in the data stream to read from, not null
*/
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
type = in.readByte();
object = readInternal(type, in);
}