类java.io.ObjectStreamException源码实例Demo

下面列出了怎么用java.io.ObjectStreamException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openstock   文件: AxisLocation.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(AxisLocation.TOP_OR_RIGHT)) {
        return AxisLocation.TOP_OR_RIGHT;
    }
    else if (this.equals(AxisLocation.BOTTOM_OR_RIGHT)) {
        return AxisLocation.BOTTOM_OR_RIGHT;
    }
    else if (this.equals(AxisLocation.TOP_OR_LEFT)) {
        return AxisLocation.TOP_OR_LEFT;
    }
    else if (this.equals(AxisLocation.BOTTOM_OR_LEFT)) {
        return AxisLocation.BOTTOM_OR_LEFT;
    }
    return null;
}
 
源代码2 项目: openstock   文件: DateTickUnitType.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(DateTickUnitType.YEAR)) {
        return DateTickUnitType.YEAR;
    }
    else if (this.equals(DateTickUnitType.MONTH)) {
        return DateTickUnitType.MONTH;
    }
    else if (this.equals(DateTickUnitType.DAY)) {
        return DateTickUnitType.DAY;
    }
    else if (this.equals(DateTickUnitType.HOUR)) {
        return DateTickUnitType.HOUR;
    }
    else if (this.equals(DateTickUnitType.MINUTE)) {
        return DateTickUnitType.MINUTE;
    }
    else if (this.equals(DateTickUnitType.SECOND)) {
        return DateTickUnitType.SECOND;
    }
    else if (this.equals(DateTickUnitType.MILLISECOND)) {
        return DateTickUnitType.MILLISECOND;
    }
    return null;
}
 
/**
 * Replaces this object with a SingletonTargetSource on serialization.
 * Protected as otherwise it won't be invoked for subclasses.
 * (The {@code writeReplace()} method must be visible to the class
 * being serialized.)
 * <p>With this implementation of this method, there is no need to mark
 * non-serializable fields in this class or subclasses as transient.
 */
protected Object writeReplace() throws ObjectStreamException {
	if (logger.isDebugEnabled()) {
		logger.debug("Disconnecting TargetSource [" + this + "]");
	}
	try {
		// Create disconnected SingletonTargetSource/EmptyTargetSource.
		Object target = getTarget();
		return (target != null ? new SingletonTargetSource(target) :
				EmptyTargetSource.forClass(getTargetClass()));
	}
	catch (Exception ex) {
		String msg = "Cannot get target for disconnecting TargetSource [" + this + "]";
		logger.error(msg, ex);
		throw new NotSerializableException(msg + ": " + ex);
	}
}
 
源代码4 项目: TencentKona-8   文件: Inet4Address.java
/**
 * Replaces the object to be serialized with an InetAddress object.
 *
 * @return the alternate object to be serialized.
 *
 * @throws ObjectStreamException if a new object replacing this
 * object could not be created
 */
private Object writeReplace() throws ObjectStreamException {
    // will replace the to be serialized 'this' object
    InetAddress inet = new InetAddress();
    inet.holder().hostName = holder().getHostName();
    inet.holder().address = holder().getAddress();

    /**
     * Prior to 1.4 an InetAddress was created with a family
     * based on the platform AF_INET value (usually 2).
     * For compatibility reasons we must therefore write the
     * the InetAddress with this family.
     */
    inet.holder().family = 2;

    return inet;
}
 
源代码5 项目: TencentKona-8   文件: URL.java
/**
  * Replaces the de-serialized object with an URL object.
  *
  * @return a newly created object from the deserialzed state.
  *
  * @throws ObjectStreamException if a new object replacing this
  * object could not be created
  */

private Object readResolve() throws ObjectStreamException {

     URLStreamHandler handler = null;
     // already been checked in readObject
     handler = getURLStreamHandler(tempState.getProtocol());

     URL replacementURL = null;
     if (isBuiltinStreamHandler(handler.getClass().getName())) {
         replacementURL = fabricateNewURL();
     } else {
         replacementURL = setDeserializedFields(handler);
     }
     return replacementURL;
 }
 
源代码6 项目: jdk1.8-source-analysis   文件: URL.java
/**
  * Replaces the de-serialized object with an URL object.
  *
  * @return a newly created object from the deserialzed state.
  *
  * @throws ObjectStreamException if a new object replacing this
  * object could not be created
  */

private Object readResolve() throws ObjectStreamException {

     URLStreamHandler handler = null;
     // already been checked in readObject
     handler = getURLStreamHandler(tempState.getProtocol());

     URL replacementURL = null;
     if (isBuiltinStreamHandler(handler.getClass().getName())) {
         replacementURL = fabricateNewURL();
     } else {
         replacementURL = setDeserializedFields(handler);
     }
     return replacementURL;
 }
 
源代码7 项目: jdk1.8-source-analysis   文件: Inet4Address.java
/**
 * Replaces the object to be serialized with an InetAddress object.
 *
 * @return the alternate object to be serialized.
 *
 * @throws ObjectStreamException if a new object replacing this
 * object could not be created
 */
private Object writeReplace() throws ObjectStreamException {
    // will replace the to be serialized 'this' object
    InetAddress inet = new InetAddress();
    inet.holder().hostName = holder().getHostName();
    inet.holder().address = holder().getAddress();

    /**
     * Prior to 1.4 an InetAddress was created with a family
     * based on the platform AF_INET value (usually 2).
     * For compatibility reasons we must therefore write the
     * the InetAddress with this family.
     */
    inet.holder().family = 2;

    return inet;
}
 
源代码8 项目: dragonwell8_jdk   文件: URL.java
/**
  * Replaces the de-serialized object with an URL object.
  *
  * @return a newly created object from the deserialzed state.
  *
  * @throws ObjectStreamException if a new object replacing this
  * object could not be created
  */

private Object readResolve() throws ObjectStreamException {

     URLStreamHandler handler = null;
     // already been checked in readObject
     handler = getURLStreamHandler(tempState.getProtocol());

     URL replacementURL = null;
     if (isBuiltinStreamHandler(handler.getClass().getName())) {
         replacementURL = fabricateNewURL();
     } else {
         replacementURL = setDeserializedFields(handler);
     }
     return replacementURL;
 }
 
源代码9 项目: dragonwell8_jdk   文件: Inet4Address.java
/**
 * Replaces the object to be serialized with an InetAddress object.
 *
 * @return the alternate object to be serialized.
 *
 * @throws ObjectStreamException if a new object replacing this
 * object could not be created
 */
private Object writeReplace() throws ObjectStreamException {
    // will replace the to be serialized 'this' object
    InetAddress inet = new InetAddress();
    inet.holder().hostName = holder().getHostName();
    inet.holder().address = holder().getAddress();

    /**
     * Prior to 1.4 an InetAddress was created with a family
     * based on the platform AF_INET value (usually 2).
     * For compatibility reasons we must therefore write the
     * the InetAddress with this family.
     */
    inet.holder().family = 2;

    return inet;
}
 
源代码10 项目: Bats   文件: AsyncFSStorageAgent.java
@Override
public Object readResolve() throws ObjectStreamException
{
  AsyncFSStorageAgent asyncFSStorageAgent = new AsyncFSStorageAgent(this.path, null);
  asyncFSStorageAgent.setSyncCheckpoint(syncCheckpoint);
  return asyncFSStorageAgent;
}
 
源代码11 项目: openstock   文件: AreaRendererEndType.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    Object result = null;
    if (this.equals(AreaRendererEndType.LEVEL)) {
        result = AreaRendererEndType.LEVEL;
    }
    else if (this.equals(AreaRendererEndType.TAPER)) {
        result = AreaRendererEndType.TAPER;
    }
    else if (this.equals(AreaRendererEndType.TRUNCATE)) {
        result = AreaRendererEndType.TRUNCATE;
    }
    return result;
}
 
源代码12 项目: openstock   文件: LengthConstraintType.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(LengthConstraintType.NONE)) {
        return LengthConstraintType.NONE;
    }
    else if (this.equals(LengthConstraintType.RANGE)) {
        return LengthConstraintType.RANGE;
    }
    else if (this.equals(LengthConstraintType.FIXED)) {
        return LengthConstraintType.FIXED;
    }
    return null;
}
 
源代码13 项目: openstock   文件: LegendRenderingOrder.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(LegendRenderingOrder.STANDARD)) {
        return LegendRenderingOrder.STANDARD;
    }
    else if (this.equals(LegendRenderingOrder.REVERSE)) {
        return LegendRenderingOrder.REVERSE;
    }
    return null;
}
 
源代码14 项目: openstock   文件: PlotOrientation.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    Object result = null;
    if (this.equals(PlotOrientation.HORIZONTAL)) {
        result = PlotOrientation.HORIZONTAL;
    }
    else if (this.equals(PlotOrientation.VERTICAL)) {
        result = PlotOrientation.VERTICAL;
    }
    return result;
}
 
源代码15 项目: openstock   文件: SeriesRenderingOrder.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(SeriesRenderingOrder.FORWARD)) {
        return SeriesRenderingOrder.FORWARD;
    }
    else if (this.equals(SeriesRenderingOrder.REVERSE)) {
        return SeriesRenderingOrder.REVERSE;
    }
    return null;
}
 
源代码16 项目: openstock   文件: PieLabelLinkStyle.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    Object result = null;
    if (this.equals(PieLabelLinkStyle.STANDARD)) {
        result = PieLabelLinkStyle.STANDARD;
    }
    else if (this.equals(PieLabelLinkStyle.QUAD_CURVE)) {
        result = PieLabelLinkStyle.QUAD_CURVE;
    }
    else if (this.equals(PieLabelLinkStyle.CUBIC_CURVE)) {
        result = PieLabelLinkStyle.CUBIC_CURVE;
    }
    return result;
}
 
源代码17 项目: openstock   文件: PolarAxisLocation.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(PolarAxisLocation.NORTH_RIGHT)) {
        return PolarAxisLocation.NORTH_RIGHT;
    }
    else if (this.equals(PolarAxisLocation.NORTH_LEFT)) {
        return PolarAxisLocation.NORTH_LEFT;
    }
    else if (this.equals(PolarAxisLocation.SOUTH_RIGHT)) {
        return PolarAxisLocation.SOUTH_RIGHT;
    }
    else if (this.equals(PolarAxisLocation.SOUTH_LEFT)) {
        return PolarAxisLocation.SOUTH_LEFT;
    }
    else if (this.equals(PolarAxisLocation.EAST_ABOVE)) {
        return PolarAxisLocation.EAST_ABOVE;
    }
    else if (this.equals(PolarAxisLocation.EAST_BELOW)) {
        return PolarAxisLocation.EAST_BELOW;
    }
    else if (this.equals(PolarAxisLocation.WEST_ABOVE)) {
        return PolarAxisLocation.WEST_ABOVE;
    }
    else if (this.equals(PolarAxisLocation.WEST_BELOW)) {
        return PolarAxisLocation.WEST_BELOW;
    }
    return null;
}
 
源代码18 项目: openstock   文件: DatasetRenderingOrder.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(DatasetRenderingOrder.FORWARD)) {
        return DatasetRenderingOrder.FORWARD;
    }
    else if (this.equals(DatasetRenderingOrder.REVERSE)) {
        return DatasetRenderingOrder.REVERSE;
    }
    return null;
}
 
源代码19 项目: openstock   文件: DialShape.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(DialShape.CIRCLE)) {
        return DialShape.CIRCLE;
    }
    else if (this.equals(DialShape.CHORD)) {
        return DialShape.CHORD;
    }
    else if (this.equals(DialShape.PIE)) {
        return DialShape.PIE;
    }
    return null;
}
 
源代码20 项目: openstock   文件: ChartChangeEventType.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(ChartChangeEventType.GENERAL)) {
        return ChartChangeEventType.GENERAL;
    }
    else if (this.equals(ChartChangeEventType.NEW_DATASET)) {
        return ChartChangeEventType.NEW_DATASET;
    }
    else if (this.equals(ChartChangeEventType.DATASET_UPDATED)) {
        return ChartChangeEventType.DATASET_UPDATED;
    }
    return null;
}
 
源代码21 项目: openstock   文件: AxisLabelLocation.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(AxisLabelLocation.HIGH_END)) {
        return AxisLabelLocation.HIGH_END;
    }
    if (this.equals(AxisLabelLocation.MIDDLE)) {
        return AxisLabelLocation.MIDDLE;
    }
    if (this.equals(AxisLabelLocation.LOW_END)) {
        return AxisLabelLocation.LOW_END;
    }

    return null;
}
 
源代码22 项目: openstock   文件: CategoryLabelWidthType.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(CategoryLabelWidthType.CATEGORY)) {
        return CategoryLabelWidthType.CATEGORY;
    }
    else if (this.equals(CategoryLabelWidthType.RANGE)) {
        return CategoryLabelWidthType.RANGE;
    }
    return null;
}
 
源代码23 项目: openstock   文件: CategoryAnchor.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(CategoryAnchor.START)) {
        return CategoryAnchor.START;
    }
    else if (this.equals(CategoryAnchor.MIDDLE)) {
        return CategoryAnchor.MIDDLE;
    }
    else if (this.equals(CategoryAnchor.END)) {
        return CategoryAnchor.END;
    }
    return null;
}
 
源代码24 项目: openstock   文件: DateTickMarkPosition.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(DateTickMarkPosition.START)) {
        return DateTickMarkPosition.START;
    }
    else if (this.equals(DateTickMarkPosition.MIDDLE)) {
        return DateTickMarkPosition.MIDDLE;
    }
    else if (this.equals(DateTickMarkPosition.END)) {
        return DateTickMarkPosition.END;
    }
    return null;
}
 
源代码25 项目: openstock   文件: TickType.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    Object result = null;
    if (this.equals(TickType.MAJOR)) {
        result = TickType.MAJOR;
    }
    else if (this.equals(TickType.MINOR)) {
        result = TickType.MINOR;
    }
    return result;
}
 
源代码26 项目: TencentKona-8   文件: EnumSyntax.java
/**
 * During object input, convert this deserialized enumeration instance to
 * the proper enumeration value defined in the enumeration attribute class.
 *
 * @return  The enumeration singleton value stored at index
 *          <I>i</I>-<I>L</I> in the enumeration value table returned by
 *          {@link #getEnumValueTable() getEnumValueTable()},
 *          where <I>i</I> is this enumeration value's integer value and
 *          <I>L</I> is the value returned by {@link #getOffset()
 *          getOffset()}.
 *
 * @throws ObjectStreamException if the stream can't be deserialised
 * @throws  InvalidObjectException
 *     Thrown if the enumeration value table is null, this enumeration
 *     value's integer value does not correspond to an element in the
 *     enumeration value table, or the corresponding element in the
 *     enumeration value table is null. (Note: {@link
 *     java.io.InvalidObjectException InvalidObjectException} is a subclass
 *     of {@link java.io.ObjectStreamException ObjectStreamException}, which
 *     <CODE>readResolve()</CODE> is declared to throw.)
 */
protected Object readResolve() throws ObjectStreamException {

    EnumSyntax[] theTable = getEnumValueTable();

    if (theTable == null) {
        throw new InvalidObjectException(
                            "Null enumeration value table for class " +
                            getClass());
    }

    int theOffset = getOffset();
    int theIndex = value - theOffset;

    if (0 > theIndex || theIndex >= theTable.length) {
        throw new InvalidObjectException
            ("Integer value = " +  value + " not in valid range " +
             theOffset + ".." + (theOffset + theTable.length - 1) +
             "for class " + getClass());
    }

    EnumSyntax result = theTable[theIndex];
    if (result == null) {
        throw new InvalidObjectException
            ("No enumeration value for integer value = " +
             value + "for class " + getClass());
    }
    return result;
}
 
源代码27 项目: openstock   文件: TimePeriodAnchor.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(TimePeriodAnchor.START)) {
        return TimePeriodAnchor.START;
    }
    else if (this.equals(TimePeriodAnchor.MIDDLE)) {
        return TimePeriodAnchor.MIDDLE;
    }
    else if (this.equals(TimePeriodAnchor.END)) {
        return TimePeriodAnchor.END;
    }
    return null;
}
 
protected Object writeReplace() throws ObjectStreamException {
	if (this.serializationId != null) {
		return new SerializedBeanFactoryReference(this.serializationId);
	}
	else {
		throw new NotSerializableException("DefaultListableBeanFactory has no serialization id");
	}
}
 
源代码29 项目: openstock   文件: HistogramType.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(HistogramType.FREQUENCY)) {
        return HistogramType.FREQUENCY;
    }
    else if (this.equals(HistogramType.RELATIVE_FREQUENCY)) {
        return HistogramType.RELATIVE_FREQUENCY;
    }
    else if (this.equals(HistogramType.SCALE_AREA_TO_1)) {
        return HistogramType.SCALE_AREA_TO_1;
    }
    return null;
}
 
源代码30 项目: openstock   文件: DomainOrder.java
/**
 * Ensures that serialization returns the unique instances.
 *
 * @return The object.
 *
 * @throws ObjectStreamException if there is a problem.
 */
private Object readResolve() throws ObjectStreamException {
    if (this.equals(DomainOrder.ASCENDING)) {
        return DomainOrder.ASCENDING;
    }
    else if (this.equals(DomainOrder.DESCENDING)) {
        return DomainOrder.DESCENDING;
    }
    else if (this.equals(DomainOrder.NONE)) {
        return DomainOrder.NONE;
    }
    return null;
}
 
 类所在包
 同包方法