Java 类java.io.StreamCorruptedException 实例源码

项目:EatDubbo    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:neoscada    文件:ObjectSerializationInputStream.java   
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);
}
项目:dubbo2    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:hekate    文件:CodecUtils.java   
/**
 * 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;
}
项目:hekate    文件:CodecUtils.java   
/**
 * 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;
}
项目:OpenJSharp    文件:IIOPInputStream.java   
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();
    }
}
项目:OpenJSharp    文件:InputStreamHook.java   
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");
    }
}
项目:OpenJSharp    文件:Ser.java   
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");
    }
}
项目:OpenJSharp    文件:StreamRemoteCall.java   
/**
 * 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;
}
项目:dubbox-hystrix    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:jdk8u-jdk    文件:Ser.java   
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");
    }
}
项目:jdk8u-jdk    文件:StreamRemoteCall.java   
/**
 * 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;
}
项目:openjdk-jdk10    文件:IIOPInputStream.java   
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");
    }
}
项目:openjdk-jdk10    文件:IIOPInputStream.java   
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();
    }
}
项目:openjdk-jdk10    文件:InputStreamHook.java   
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");
    }
}
项目:openjdk-jdk10    文件:Ser.java   
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");
    }
}
项目:openjdk-jdk10    文件:Properties.java   
@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);
    }
}
项目:openjdk-jdk10    文件:StreamRemoteCall.java   
/**
 * 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;
}
项目:dubbocloud    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:openjdk9    文件:IIOPInputStream.java   
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();
    }
}
项目:openjdk9    文件:InputStreamHook.java   
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");
    }
}
项目:openjdk9    文件:Ser.java   
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");
    }
}
项目:openjdk9    文件:StreamRemoteCall.java   
/**
 * 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;
}
项目:Java8CN    文件:Ser.java   
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");
    }
}
项目:jahhan    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Ser.java   
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");
    }
}
项目:Skript    文件:YggdrasilInputStream.java   
@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");
        }
    }
项目:dubbos    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:gemfirexd-oss    文件:T_Undoable.java   
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");
    }
项目:dubbo-comments    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:dubbox    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:dubbo    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:dubbo3    文件:CompactedObjectInputStream.java   
@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);
    }
}
项目:jdk8u_jdk    文件:StreamRemoteCall.java   
/**
 * 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;
}
项目:Skript    文件:Direction.java   
@Override
public boolean excessiveField(@NonNull final FieldContext field) throws StreamCorruptedException {
    if (field.getID().equals("mod")) {
        final double[] mod = field.getObject(double[].class);
        if (mod == null)
            return true;
        if (mod.length != 3)
            throw new StreamCorruptedException();
        set("pitchOrX", mod[0]);
        set("yawOrY", mod[1]);
        set("lengthOrZ", mod[1]);
        return true;
    } else if (field.getID().equals("pitch")) {
        set("pitchOrX", field.getPrimitive(double.class));
        return true;
    } else if (field.getID().equals("yaw")) {
        set("yawOrY", field.getPrimitive(double.class));
        return true;
    } else if (field.getID().equals("length")) {
        set("lengthOrZ", field.getPrimitive(double.class));
        return true;
    } else {
        return false;
    }
}
项目:offloading-framework-android    文件:Utils.java   
public static Object byteArrayToObject(byte[] bytes)
    throws StreamCorruptedException, IOException, ClassNotFoundException {
  Object obj = null;
  ByteArrayInputStream bis = null;
  ObjectInputStream ois = null;
  try {
    bis = new ByteArrayInputStream(bytes);
    ois = new ObjectInputStream(bis);
    obj = ois.readObject();
  } finally {
    if (bis != null) {
      bis.close();
    }
    if (ois != null) {
      ois.close();
    }
  }
  return obj;
}
项目:Skript    文件:Fields.java   
public void setField(final Object o, final Field f, final Yggdrasil y) throws StreamCorruptedException {
    if (Modifier.isStatic(f.getModifiers()))
        throw new StreamCorruptedException("The field " + id + " of " + f.getDeclaringClass() + " is static");
    if (Modifier.isTransient(f.getModifiers()))
        throw new StreamCorruptedException("The field " + id + " of " + f.getDeclaringClass() + " is transient");
    if (f.getType().isPrimitive() != isPrimitiveValue)
        throw new StreamCorruptedException("The field " + id + " of " + f.getDeclaringClass() + " is " + (f.getType().isPrimitive() ? "" : "not ") + "primitive");
    try {
        f.setAccessible(true);
        f.set(o, value);
    } catch (final IllegalArgumentException e) {
        if (!(o instanceof YggdrasilRobustSerializable) || !((YggdrasilRobustSerializable) o).incompatibleField(f, this))
            y.incompatibleField(o, f, this);
    } catch (final IllegalAccessException e) {
        assert false;
    }
}
项目:Skript    文件:Fields.java   
/**
 * Sets all fields of the given Object to the values stored in this Fields object.
 * 
 * @param o The object whose fields should be set
 * @throws StreamCorruptedException
 * @throws NotSerializableException
 * @throws YggdrasilException If this was called on a Fields object not created by Yggdrasil itself
 */
public void setFields(final Object o) throws StreamCorruptedException, NotSerializableException {
    final Yggdrasil y = yggdrasil;
    if (y == null)
        throw new YggdrasilException("");
    final Set<FieldContext> excessive = new HashSet<FieldContext>(fields.values());
    final Class<?> oc = o.getClass();
    assert oc != null;
    for (final Field f : getFields(oc)) {
        assert f != null;
        final String id = Yggdrasil.getID(f);
        final FieldContext c = fields.get(id);
        if (c == null) {
            if (!(o instanceof YggdrasilRobustSerializable) || !((YggdrasilRobustSerializable) o).missingField(f))
                y.missingField(o, f);
        } else {
            c.setField(o, f, y);
        }
        excessive.remove(c);
    }
    for (final FieldContext f : excessive) {
        assert f != null;
        if (!(o instanceof YggdrasilRobustSerializable) || !((YggdrasilRobustSerializable) o).excessiveField(f))
            y.excessiveField(o, f);
    }
}
项目:jdk8u_jdk    文件:Ser.java   
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");
    }
}
项目:Skript    文件:YggXMLInputStream.java   
@SuppressWarnings("null")
private Class<?> getType(String s) throws StreamCorruptedException {
    int dim = 0;
    while (s.endsWith("[]")) {
        s = "" + s.substring(0, s.length() - 2);
        dim++;
    }
    Class<?> c;
    final Tag t = Tag.byName(s);
    if (t != null)
        c = t.c;
    else
        c = yggdrasil.getClass(s);
    if (c == null)
        throw new StreamCorruptedException("Invalid type " + s);
    if (dim == 0)
        return c;
    while (dim-- > 0)
        c = Array.newInstance(c, 0).getClass();
    return c;
}