java类java.io.StreamCorruptedException的实例源码

CompactedObjectInputStream.java 文件源码 项目:EatDubbo 阅读 19 收藏 0 点赞 0 评论 0
@Override
protected ObjectStreamClass readClassDescriptor() throws IOException,ClassNotFoundException
{
    int type = read();
    if( type < 0 )
        throw new EOFException();
    switch( type )
    {
        case 0:
            return super.readClassDescriptor();
        case 1:
            Class<?> clazz = loadClass(readUTF());
            return ObjectStreamClass.lookup(clazz);
        default:
            throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
    }
}
ObjectSerializationInputStream.java 文件源码 项目:neoscada 阅读 27 收藏 0 点赞 0 评论 0
public Object readObject() throws ClassNotFoundException, IOException {
    int objectSize = in.readInt();
    if (objectSize <= 0) {
        throw new StreamCorruptedException("Invalid objectSize: " + objectSize);
    }
    if (objectSize > maxObjectSize) {
        throw new StreamCorruptedException("ObjectSize too big: " + objectSize + " (expected: <= " + maxObjectSize
                + ')');
    }

    IoBuffer buf = IoBuffer.allocate(objectSize + 4, false);
    buf.putInt(objectSize);
    in.readFully(buf.array(), 4, objectSize);
    buf.position(0);
    buf.limit(objectSize + 4);

    return buf.getObject(classLoader);
}
CompactedObjectInputStream.java 文件源码 项目:dubbo2 阅读 19 收藏 0 点赞 0 评论 0
@Override
protected ObjectStreamClass readClassDescriptor() throws IOException,ClassNotFoundException
{
    int type = read();
    if( type < 0 )
        throw new EOFException();
    switch( type )
    {
        case 0:
            return super.readClassDescriptor();
        case 1:
            Class<?> clazz = loadClass(readUTF());
            return ObjectStreamClass.lookup(clazz);
        default:
            throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
    }
}
CodecUtils.java 文件源码 项目:hekate 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Reads a value that was encoded via {@link #writeVarLongUnsigned(long, DataOutput)}.
 *
 * @param in Data input.
 *
 * @return Value.
 *
 * @throws IOException if failed to read value.
 */
// Code borrowed from 'stream-lib' (Apache 2.0 license) - see https://github.com/addthis/stream-lib
public static long readVarLongUnsigned(DataInput in) throws IOException {
    long value = 0L;
    int i = 0;
    long b;

    while (((b = in.readByte()) & 0x80L) != 0) {
        value |= (b & 0x7F) << i;

        i += 7;

        if (i > 63) {
            throw new StreamCorruptedException("Variable length size is too long");
        }
    }

    return value | b << i;
}
CodecUtils.java 文件源码 项目:hekate 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Reads a value that was encoded via {@link #writeVarIntUnsigned(int, DataOutput)}.
 *
 * @param in Data input.
 *
 * @return Value.
 *
 * @throws IOException if failed to read value.
 */
// Code borrowed from 'stream-lib' (Apache 2.0 license) - see https://github.com/addthis/stream-lib
public static int readVarIntUnsigned(DataInput in) throws IOException {
    int value = 0;
    int i = 0;
    int b;

    while (((b = in.readByte()) & 0x80) != 0) {
        value |= (b & 0x7F) << i;

        i += 7;

        if (i > 35) {
            throw new StreamCorruptedException("Variable length size is too long");
        }
    }

    return value | b << i;
}
IIOPInputStream.java 文件源码 项目:OpenJSharp 阅读 16 收藏 0 点赞 0 评论 0
private void skipCustomUsingFVD(ValueMember[] fields,
                                com.sun.org.omg.SendingContext.CodeBase sender)
                                throws InvalidClassException, StreamCorruptedException,
                                       ClassNotFoundException, IOException
{
    readFormatVersion();
    boolean calledDefaultWriteObject = readBoolean();

    if (calledDefaultWriteObject)
        throwAwayData(fields, sender);

    if (getStreamFormatVersion() == 2) {

        ((ValueInputStream)getOrbStream()).start_value();
        ((ValueInputStream)getOrbStream()).end_value();
    }
}
InputStreamHook.java 文件源码 项目:OpenJSharp 阅读 17 收藏 0 点赞 0 评论 0
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
Ser.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException {
    switch (type) {
        case DURATION_TYPE: return Duration.readExternal(in);
        case INSTANT_TYPE: return Instant.readExternal(in);
        case LOCAL_DATE_TYPE: return LocalDate.readExternal(in);
        case LOCAL_DATE_TIME_TYPE: return LocalDateTime.readExternal(in);
        case LOCAL_TIME_TYPE: return LocalTime.readExternal(in);
        case ZONE_DATE_TIME_TYPE: return ZonedDateTime.readExternal(in);
        case ZONE_OFFSET_TYPE: return ZoneOffset.readExternal(in);
        case ZONE_REGION_TYPE: return ZoneRegion.readExternal(in);
        case OFFSET_TIME_TYPE: return OffsetTime.readExternal(in);
        case OFFSET_DATE_TIME_TYPE: return OffsetDateTime.readExternal(in);
        case YEAR_TYPE: return Year.readExternal(in);
        case YEAR_MONTH_TYPE: return YearMonth.readExternal(in);
        case MONTH_DAY_TYPE: return MonthDay.readExternal(in);
        case PERIOD_TYPE: return Period.readExternal(in);
        default:
            throw new StreamCorruptedException("Unknown serialized type");
    }
}
StreamRemoteCall.java 文件源码 项目:OpenJSharp 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Returns an output stream (may put out header information
 * relating to the success of the call).
 * @param success If true, indicates normal return, else indicates
 * exceptional return.
 * @exception StreamCorruptedException If result stream previously
 * acquired
 * @exception IOException For any other problem with I/O.
 */
public ObjectOutput getResultStream(boolean success) throws IOException {
    /* make sure result code only marshaled once. */
    if (resultStarted)
        throw new StreamCorruptedException("result already in progress");
    else
        resultStarted = true;

    // write out return header
    // return header, part 1 (read by Transport)
    DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
    wr.writeByte(TransportConstants.Return);// transport op
    getOutputStream(true);  // creates a MarshalOutputStream
    // return header, part 2 (read by client-side RemoteCall)
    if (success)            //
        out.writeByte(TransportConstants.NormalReturn);
    else
        out.writeByte(TransportConstants.ExceptionalReturn);
    out.writeID();          // write id for gcAck
    return out;
}
CompactedObjectInputStream.java 文件源码 项目:dubbox-hystrix 阅读 20 收藏 0 点赞 0 评论 0
@Override
protected ObjectStreamClass readClassDescriptor() throws IOException,ClassNotFoundException
{
    int type = read();
    if( type < 0 )
        throw new EOFException();
    switch( type )
    {
        case 0:
            return super.readClassDescriptor();
        case 1:
            Class<?> clazz = loadClass(readUTF());
            return ObjectStreamClass.lookup(clazz);
        default:
            throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
    }
}
Ser.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException {
    switch (type) {
        case DURATION_TYPE: return Duration.readExternal(in);
        case INSTANT_TYPE: return Instant.readExternal(in);
        case LOCAL_DATE_TYPE: return LocalDate.readExternal(in);
        case LOCAL_DATE_TIME_TYPE: return LocalDateTime.readExternal(in);
        case LOCAL_TIME_TYPE: return LocalTime.readExternal(in);
        case ZONE_DATE_TIME_TYPE: return ZonedDateTime.readExternal(in);
        case ZONE_OFFSET_TYPE: return ZoneOffset.readExternal(in);
        case ZONE_REGION_TYPE: return ZoneRegion.readExternal(in);
        case OFFSET_TIME_TYPE: return OffsetTime.readExternal(in);
        case OFFSET_DATE_TIME_TYPE: return OffsetDateTime.readExternal(in);
        case YEAR_TYPE: return Year.readExternal(in);
        case YEAR_MONTH_TYPE: return YearMonth.readExternal(in);
        case MONTH_DAY_TYPE: return MonthDay.readExternal(in);
        case PERIOD_TYPE: return Period.readExternal(in);
        default:
            throw new StreamCorruptedException("Unknown serialized type");
    }
}
StreamRemoteCall.java 文件源码 项目:jdk8u-jdk 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Returns an output stream (may put out header information
 * relating to the success of the call).
 * @param success If true, indicates normal return, else indicates
 * exceptional return.
 * @exception StreamCorruptedException If result stream previously
 * acquired
 * @exception IOException For any other problem with I/O.
 */
public ObjectOutput getResultStream(boolean success) throws IOException {
    /* make sure result code only marshaled once. */
    if (resultStarted)
        throw new StreamCorruptedException("result already in progress");
    else
        resultStarted = true;

    // write out return header
    // return header, part 1 (read by Transport)
    DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
    wr.writeByte(TransportConstants.Return);// transport op
    getOutputStream(true);  // creates a MarshalOutputStream
    // return header, part 2 (read by client-side RemoteCall)
    if (success)            //
        out.writeByte(TransportConstants.NormalReturn);
    else
        out.writeByte(TransportConstants.ExceptionalReturn);
    out.writeID();          // write id for gcAck
    return out;
}
IIOPInputStream.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, Class aclass)
    throws InvalidClassException, StreamCorruptedException,
           ClassNotFoundException, IOException
{
    try {
        return osc.invokeReadObject( obj, this ) ;
    } catch (InvocationTargetException e) {
        Throwable t = e.getTargetException();
        if (t instanceof ClassNotFoundException)
            throw (ClassNotFoundException)t;
        else if (t instanceof IOException)
            throw (IOException)t;
        else if (t instanceof RuntimeException)
            throw (RuntimeException) t;
        else if (t instanceof Error)
            throw (Error) t;
        else
            // XXX I18N, logging needed.
            throw new Error("internal error");
    }
}
IIOPInputStream.java 文件源码 项目:openjdk-jdk10 阅读 21 收藏 0 点赞 0 评论 0
private void skipCustomUsingFVD(ValueMember[] fields,
                                com.sun.org.omg.SendingContext.CodeBase sender)
                                throws InvalidClassException, StreamCorruptedException,
                                       ClassNotFoundException, IOException
{
    readFormatVersion();
    boolean calledDefaultWriteObject = readBoolean();

    if (calledDefaultWriteObject)
        throwAwayData(fields, sender);

    if (getStreamFormatVersion() == 2) {

        ((ValueInputStream)getOrbStream()).start_value();
        ((ValueInputStream)getOrbStream()).end_value();
    }
}
InputStreamHook.java 文件源码 项目:openjdk-jdk10 阅读 18 收藏 0 点赞 0 评论 0
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
Ser.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException {
    switch (type) {
        case DURATION_TYPE: return Duration.readExternal(in);
        case INSTANT_TYPE: return Instant.readExternal(in);
        case LOCAL_DATE_TYPE: return LocalDate.readExternal(in);
        case LOCAL_DATE_TIME_TYPE: return LocalDateTime.readExternal(in);
        case LOCAL_TIME_TYPE: return LocalTime.readExternal(in);
        case ZONE_DATE_TIME_TYPE: return ZonedDateTime.readExternal(in);
        case ZONE_OFFSET_TYPE: return ZoneOffset.readExternal(in);
        case ZONE_REGION_TYPE: return ZoneRegion.readExternal(in);
        case OFFSET_TIME_TYPE: return OffsetTime.readExternal(in);
        case OFFSET_DATE_TIME_TYPE: return OffsetDateTime.readExternal(in);
        case YEAR_TYPE: return Year.readExternal(in);
        case YEAR_MONTH_TYPE: return YearMonth.readExternal(in);
        case MONTH_DAY_TYPE: return MonthDay.readExternal(in);
        case PERIOD_TYPE: return Period.readExternal(in);
        default:
            throw new StreamCorruptedException("Unknown serialized type");
    }
}
Properties.java 文件源码 项目:openjdk-jdk10 阅读 30 收藏 0 点赞 0 评论 0
@Override
void readHashtable(ObjectInputStream s) throws IOException,
        ClassNotFoundException {
    // Read in the threshold and loadfactor
    s.defaultReadObject();

    // Read the original length of the array and number of elements
    int origlength = s.readInt();
    int elements = s.readInt();

    // Validate # of elements
    if (elements < 0) {
        throw new StreamCorruptedException("Illegal # of Elements: " + elements);
    }

    // create CHM of appropriate capacity
    map = new ConcurrentHashMap<>(elements);

    // Read all the key/value objects
    for (; elements > 0; elements--) {
        Object key = s.readObject();
        Object value = s.readObject();
        map.put(key, value);
    }
}
StreamRemoteCall.java 文件源码 项目:openjdk-jdk10 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Returns an output stream (may put out header information
 * relating to the success of the call).
 * @param success If true, indicates normal return, else indicates
 * exceptional return.
 * @exception StreamCorruptedException If result stream previously
 * acquired
 * @exception IOException For any other problem with I/O.
 */
public ObjectOutput getResultStream(boolean success) throws IOException {
    /* make sure result code only marshaled once. */
    if (resultStarted)
        throw new StreamCorruptedException("result already in progress");
    else
        resultStarted = true;

    // write out return header
    // return header, part 1 (read by Transport)
    DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
    wr.writeByte(TransportConstants.Return);// transport op
    getOutputStream(true);  // creates a MarshalOutputStream
    // return header, part 2 (read by client-side RemoteCall)
    if (success)            //
        out.writeByte(TransportConstants.NormalReturn);
    else
        out.writeByte(TransportConstants.ExceptionalReturn);
    out.writeID();          // write id for gcAck
    return out;
}
CompactedObjectInputStream.java 文件源码 项目:dubbocloud 阅读 21 收藏 0 点赞 0 评论 0
@Override
protected ObjectStreamClass readClassDescriptor() throws IOException,ClassNotFoundException
{
    int type = read();
    if( type < 0 )
        throw new EOFException();
    switch( type )
    {
        case 0:
            return super.readClassDescriptor();
        case 1:
            Class<?> clazz = loadClass(readUTF());
            return ObjectStreamClass.lookup(clazz);
        default:
            throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
    }
}
IIOPInputStream.java 文件源码 项目:openjdk9 阅读 15 收藏 0 点赞 0 评论 0
private void skipCustomUsingFVD(ValueMember[] fields,
                                com.sun.org.omg.SendingContext.CodeBase sender)
                                throws InvalidClassException, StreamCorruptedException,
                                       ClassNotFoundException, IOException
{
    readFormatVersion();
    boolean calledDefaultWriteObject = readBoolean();

    if (calledDefaultWriteObject)
        throwAwayData(fields, sender);

    if (getStreamFormatVersion() == 2) {

        ((ValueInputStream)getOrbStream()).start_value();
        ((ValueInputStream)getOrbStream()).end_value();
    }
}
InputStreamHook.java 文件源码 项目:openjdk9 阅读 61 收藏 0 点赞 0 评论 0
public void readData(InputStreamHook stream) throws IOException {
    org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
    if ((orb == null) ||
            !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
        throw new StreamCorruptedException(
                             "Default data must be read first");
    }
    ORBVersion clientOrbVersion =
        ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion();

    // Fix Date interop bug. For older versions of the ORB don't do
    // anything for readData(). Before this used to throw
    // StreamCorruptedException for older versions of the ORB where
    // calledDefaultWriteObject always returns true.
    if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
            (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
        // XXX I18N and logging needed.
        throw new StreamCorruptedException("Default data must be read first");
    }
}
Ser.java 文件源码 项目:openjdk9 阅读 20 收藏 0 点赞 0 评论 0
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException {
    switch (type) {
        case DURATION_TYPE: return Duration.readExternal(in);
        case INSTANT_TYPE: return Instant.readExternal(in);
        case LOCAL_DATE_TYPE: return LocalDate.readExternal(in);
        case LOCAL_DATE_TIME_TYPE: return LocalDateTime.readExternal(in);
        case LOCAL_TIME_TYPE: return LocalTime.readExternal(in);
        case ZONE_DATE_TIME_TYPE: return ZonedDateTime.readExternal(in);
        case ZONE_OFFSET_TYPE: return ZoneOffset.readExternal(in);
        case ZONE_REGION_TYPE: return ZoneRegion.readExternal(in);
        case OFFSET_TIME_TYPE: return OffsetTime.readExternal(in);
        case OFFSET_DATE_TIME_TYPE: return OffsetDateTime.readExternal(in);
        case YEAR_TYPE: return Year.readExternal(in);
        case YEAR_MONTH_TYPE: return YearMonth.readExternal(in);
        case MONTH_DAY_TYPE: return MonthDay.readExternal(in);
        case PERIOD_TYPE: return Period.readExternal(in);
        default:
            throw new StreamCorruptedException("Unknown serialized type");
    }
}
StreamRemoteCall.java 文件源码 项目:openjdk9 阅读 14 收藏 0 点赞 0 评论 0
/**
 * Returns an output stream (may put out header information
 * relating to the success of the call).
 * @param success If true, indicates normal return, else indicates
 * exceptional return.
 * @exception StreamCorruptedException If result stream previously
 * acquired
 * @exception IOException For any other problem with I/O.
 */
public ObjectOutput getResultStream(boolean success) throws IOException {
    /* make sure result code only marshaled once. */
    if (resultStarted)
        throw new StreamCorruptedException("result already in progress");
    else
        resultStarted = true;

    // write out return header
    // return header, part 1 (read by Transport)
    DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
    wr.writeByte(TransportConstants.Return);// transport op
    getOutputStream(true);  // creates a MarshalOutputStream
    // return header, part 2 (read by client-side RemoteCall)
    if (success)            //
        out.writeByte(TransportConstants.NormalReturn);
    else
        out.writeByte(TransportConstants.ExceptionalReturn);
    out.writeID();          // write id for gcAck
    return out;
}
Ser.java 文件源码 项目:Java8CN 阅读 22 收藏 0 点赞 0 评论 0
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException {
    switch (type) {
        case DURATION_TYPE: return Duration.readExternal(in);
        case INSTANT_TYPE: return Instant.readExternal(in);
        case LOCAL_DATE_TYPE: return LocalDate.readExternal(in);
        case LOCAL_DATE_TIME_TYPE: return LocalDateTime.readExternal(in);
        case LOCAL_TIME_TYPE: return LocalTime.readExternal(in);
        case ZONE_DATE_TIME_TYPE: return ZonedDateTime.readExternal(in);
        case ZONE_OFFSET_TYPE: return ZoneOffset.readExternal(in);
        case ZONE_REGION_TYPE: return ZoneRegion.readExternal(in);
        case OFFSET_TIME_TYPE: return OffsetTime.readExternal(in);
        case OFFSET_DATE_TIME_TYPE: return OffsetDateTime.readExternal(in);
        case YEAR_TYPE: return Year.readExternal(in);
        case YEAR_MONTH_TYPE: return YearMonth.readExternal(in);
        case MONTH_DAY_TYPE: return MonthDay.readExternal(in);
        case PERIOD_TYPE: return Period.readExternal(in);
        default:
            throw new StreamCorruptedException("Unknown serialized type");
    }
}
CompactedObjectInputStream.java 文件源码 项目:jahhan 阅读 19 收藏 0 点赞 0 评论 0
@Override
protected ObjectStreamClass readClassDescriptor() throws IOException,ClassNotFoundException
{
    int type = read();
    if( type < 0 )
        throw new EOFException();
    switch( type )
    {
        case 0:
            return super.readClassDescriptor();
        case 1:
            Class<?> clazz = loadClass(readUTF());
            return ObjectStreamClass.lookup(clazz);
        default:
            throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
    }
}
Ser.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 24 收藏 0 点赞 0 评论 0
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException {
    switch (type) {
        case DURATION_TYPE: return Duration.readExternal(in);
        case INSTANT_TYPE: return Instant.readExternal(in);
        case LOCAL_DATE_TYPE: return LocalDate.readExternal(in);
        case LOCAL_DATE_TIME_TYPE: return LocalDateTime.readExternal(in);
        case LOCAL_TIME_TYPE: return LocalTime.readExternal(in);
        case ZONE_DATE_TIME_TYPE: return ZonedDateTime.readExternal(in);
        case ZONE_OFFSET_TYPE: return ZoneOffset.readExternal(in);
        case ZONE_REGION_TYPE: return ZoneRegion.readExternal(in);
        case OFFSET_TIME_TYPE: return OffsetTime.readExternal(in);
        case OFFSET_DATE_TIME_TYPE: return OffsetDateTime.readExternal(in);
        case YEAR_TYPE: return Year.readExternal(in);
        case YEAR_MONTH_TYPE: return YearMonth.readExternal(in);
        case MONTH_DAY_TYPE: return MonthDay.readExternal(in);
        case PERIOD_TYPE: return Period.readExternal(in);
        default:
            throw new StreamCorruptedException("Unknown serialized type");
    }
}
YggdrasilInputStream.java 文件源码 项目:Skript 阅读 16 收藏 0 点赞 0 评论 0
@SuppressWarnings({"unchecked", "rawtypes"})
    private final Object readEnum() throws IOException {
        final Class<?> c = readEnumType();
        final String id = readEnumID();
        if (Enum.class.isAssignableFrom(c)) {
            return Yggdrasil.getEnumConstant((Class) c, id);
        } else if (PseudoEnum.class.isAssignableFrom(c)) {
            final Object o = PseudoEnum.valueOf((Class) c, id);
            if (o != null)
                return o;
//          if (YggdrasilRobustPseudoEnum.class.isAssignableFrom(c)) {
//              // TODO create this and a handler (for Enums as well)
//          }
            throw new StreamCorruptedException("Enum constant " + id + " does not exist in " + c);
        } else {
            throw new StreamCorruptedException(c + " is not an enum type");
        }
    }
CompactedObjectInputStream.java 文件源码 项目:dubbos 阅读 19 收藏 0 点赞 0 评论 0
@Override
protected ObjectStreamClass readClassDescriptor() throws IOException,ClassNotFoundException
{
    int type = read();
    if( type < 0 )
        throw new EOFException();
    switch( type )
    {
        case 0:
            return super.readClassDescriptor();
        case 1:
            Class<?> clazz = loadClass(readUTF());
            return ObjectStreamClass.lookup(clazz);
        default:
            throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
    }
}
T_Undoable.java 文件源码 项目:gemfirexd-oss 阅读 15 收藏 0 点赞 0 评论 0
public void readExternal(ObjectInput in) 
    throws IOException,ClassNotFoundException
    {
//MsgTrace.traceString("{{{tu.readExternal");
        try
        {
            tid = (GlobalTransactionId)in.readObject();
            tranSeq = in.readInt();
            recordSeq = in.readInt();
            removeWhat = in.readInt();
            LWMTranSeq = in.readInt();
            rollBack = in.readBoolean();
            lastRecord = in.readInt();
            lastTransaction = in.readBoolean();
            optionalDataLen = in.readInt();
        }

        catch ( ClassCastException exception ) {
//MsgTrace.traceString("{{{tu.readExternal---exception");
            throw new StreamCorruptedException();
        }
//MsgTrace.traceString("}}}tu.readExternal");
    }
CompactedObjectInputStream.java 文件源码 项目:dubbo-comments 阅读 20 收藏 0 点赞 0 评论 0
@Override
protected ObjectStreamClass readClassDescriptor() throws IOException,ClassNotFoundException
{
    int type = read();
    if( type < 0 )
        throw new EOFException();
    switch( type )
    {
        case 0:
            return super.readClassDescriptor();
        case 1:
            Class<?> clazz = loadClass(readUTF());
            return ObjectStreamClass.lookup(clazz);
        default:
            throw new StreamCorruptedException("Unexpected class descriptor type: " + type);
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号