Java Code Examples for java.io.ObjectInput#readByte()

The following examples show how to use java.io.ObjectInput#readByte() . 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: DefaultLeafCoder.java    From database with GNU General Public License v2.0 6 votes vote down vote up
@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();
    
}
 
Example 2
Source File: Term2IdTupleSerializer.java    From database with GNU General Public License v2.0 6 votes vote down vote up
@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);
    }

}
 
Example 3
Source File: JSQLType.java    From gemfirexd-oss with Apache License 2.0 6 votes vote down vote up
/**
  @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;
	}
}
 
Example 4
Source File: EJBResponse.java    From tomee with Apache License 2.0 6 votes vote down vote up
@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();
        }
    }
}
 
Example 5
Source File: XIndividualReservation.java    From unitime with Apache License 2.0 5 votes vote down vote up
@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;
	}
}
 
Example 6
Source File: ThaiSolarCalendar.java    From Time4A with Apache License 2.0 5 votes vote down vote up
@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.");
    }

}
 
Example 7
Source File: AuthenticationSessionEntity.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public AuthenticationSessionEntity readObject(ObjectInput input) throws IOException, ClassNotFoundException {
    switch (input.readByte()) {
        case VERSION_1:
            return readObjectVersion1(input);
        default:
            throw new IOException("Unknown version");
    }
}
 
Example 8
Source File: PolicyRemovedEvent.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public PolicyRemovedEvent readObject(ObjectInput input) throws IOException, ClassNotFoundException {
    switch (input.readByte()) {
        case VERSION_1:
            return readObjectVersion1(input);
        default:
            throw new IOException("Unknown version");
    }
}
 
Example 9
Source File: RootAuthenticationSessionPredicate.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public RootAuthenticationSessionPredicate readObject(ObjectInput input) throws IOException, ClassNotFoundException {
    switch (input.readByte()) {
        case VERSION_1:
            return readObjectVersion1(input);
        default:
            throw new IOException("Unknown version");
    }
}
 
Example 10
Source File: ServerMetaData.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    final byte version = in.readByte();

    locations = (URI[]) in.readObject();
    location = locations[0];
}
 
Example 11
Source File: SPX.java    From Time4A with Apache License 2.0 5 votes vote down vote up
/**
 * <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.");
    }

}
 
Example 12
Source File: MultiThreadedTx.java    From reladomo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 13
Source File: InitializerState.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
public InitializerState readObject(ObjectInput input) throws IOException, ClassNotFoundException {
    switch (input.readByte()) {
        case VERSION_1:
            return readObjectVersion1(input);
        default:
            throw new IOException("Unknown version");
    }
}
 
Example 14
Source File: SPX.java    From Time4A with Apache License 2.0 4 votes vote down vote up
/**
 * <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.");
    }

}
 
Example 15
Source File: CharacterIdChannelPair.java    From mapleLemon with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    this.charid = in.readInt();
    this.channel = in.readByte();
}
 
Example 16
Source File: Ser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
static Object read(ObjectInput in) throws IOException, ClassNotFoundException {
    byte type = in.readByte();
    return readInternal(type, in);
}
 
Example 17
Source File: Ser.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example 18
Source File: Ser.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example 19
Source File: Ser.java    From desugar_jdk_libs with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}
 
Example 20
Source File: Ser.java    From desugar_jdk_libs with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
}