當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectStreamException類代碼示例

本文整理匯總了Java中java.io.ObjectStreamException的典型用法代碼示例。如果您正苦於以下問題:Java ObjectStreamException類的具體用法?Java ObjectStreamException怎麽用?Java ObjectStreamException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ObjectStreamException類屬於java.io包,在下文中一共展示了ObjectStreamException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
  * Replaces the de-serialized object with an URL object.
  *
  * @return a newly created object from deserialized data
  *
  * @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;
 }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:URL.java

示例2: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
private Object readResolve() throws ObjectStreamException {
    // The old index field used to uniquely identify the time unit.
    switch (index) {
    case 6:
        return SECOND;
    case 5:
        return MINUTE;
    case 4:
        return HOUR;
    case 3:
        return DAY;
    case 2:
        return WEEK;
    case 1:
        return MONTH;
    case 0:
        return YEAR;
    default:
        throw new InvalidObjectException("Bad index: " + index);
    }
}
 
開發者ID:abhijitvalluri,項目名稱:fitnotifications,代碼行數:22,代碼來源:TimeUnit.java

示例3: writeReplace

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:Inet4Address.java

示例4: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:23,代碼來源:AxisLocation.java

示例5: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:17,代碼來源:DatasetRenderingOrder.java

示例6: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/** Make serialization work. **/
private Object readResolve () throws ObjectStreamException
   {
       switch(type) {
       	case 1:
       		return LOWER;
       	case 2:
       		return UPPER;
       }
       throw new InvalidObjectException("Unknown type: " + type);
   }
 
開發者ID:blubin,項目名稱:JOpt,代碼行數:12,代碼來源:MIPInfeasibleException.java

示例7: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
public Object readResolve() throws ObjectStreamException {
    try {
        Class c = Lookup.getDefault().lookup(ClassLoader.class).loadClass("org.netbeans.modules.debugger.ui.views.View"); // NOI18N
        Method m = c.getDeclaredMethod("getSourcesView", new Class[] {}); // NOI18N
        Object tc = m.invoke(null, new Object[] {});
        return tc;
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:SourcesView.java

示例8: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:LengthConstraintType.java

示例9: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
private Object readResolve() throws ObjectStreamException {
    if (value == Special.NULL_VALUE) {
        return Primitive.NULL;
    } else if (value == Special.VOID_TYPE) {
        return Primitive.VOID;
    } else {
        return this;
    }
}
 
開發者ID:imkiva,項目名稱:Krine,代碼行數:10,代碼來源:Primitive.java

示例10: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:21,代碼來源:AreaRendererEndType.java

示例11: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:DialShape.java

示例12: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/** Resolve to singleton instance, if needed. */
public Object readResolve ()
throws ObjectStreamException {
    if (global) {
        return getDefault();
    } else {
        if ((nodes == null) || (nodes.length <= 0)) {
            return null;
        }
    }
    return this;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:NbSheet.java

示例13: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:CategoryAnchor.java

示例14: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
private Object readResolve() throws ObjectStreamException {
	mutex = new Object();
	coverPoints = new HashMap<Integer, Set<VisibilityLocation>>();
	visiblePoints = new HashMap<Integer, Set<VisibilityLocation>>();
	coverNavPoints = new HashMap<Integer, Set<NavPoint>>();
	visibleNavPoints = new HashMap<Integer, Set<NavPoint>>();
	
	return this;
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:10,代碼來源:VisibilityMatrix.java

示例15: readResolve

import java.io.ObjectStreamException; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:HistogramType.java


注:本文中的java.io.ObjectStreamException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。