java.io.ObjectOutputStream.replaceObject()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中java.io.ObjectOutputStream.replaceObject()方法的一些代码示例,展示了ObjectOutputStream.replaceObject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectOutputStream.replaceObject()方法的具体详情如下:
包路径:java.io.ObjectOutputStream
类名称:ObjectOutputStream
方法名:replaceObject

ObjectOutputStream.replaceObject介绍

[英]Allows trusted subclasses to substitute the specified original object with a new object. Object substitution has to be activated first with calling enableReplaceObject(true). This implementation just returns object.
[中]允许受信任的子类用新对象替换指定的原始对象。必须首先通过调用enableReplaceObject(true)激活对象替换。这个实现只返回对象。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

public Object replaceObject(Object obj) throws IOException {
  if (obj instanceof Image) {
    return null;
    // [LIGHT]
    // additional code needed for full version
  }
  return super.replaceObject(obj);
}

代码示例来源:origin: Bukkit/Bukkit

@Override
  protected Object replaceObject(Object obj) throws IOException {
    if (!(obj instanceof Serializable) && (obj instanceof ConfigurationSerializable)) {
      obj = Wrapper.newWrapper((ConfigurationSerializable) obj);
    }

    return super.replaceObject(obj);
  }
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
  @Nullable @Override protected Object replaceObject(Object o) throws IOException {
    return o == null || MarshallerExclusions.isExcluded(o.getClass()) ? null :
      o.getClass().equals(Object.class) ? new JdkMarshallerDummySerializable() : super.replaceObject(o);
  }
}

代码示例来源:origin: orbit/orbit

return super.replaceObject(obj);

代码示例来源:origin: robovm/robovm

Object streamReplacement = replaceObject(object);
if (streamReplacement != object) {

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public Object replaceObject (Object obj) throws IOException {
  if (obj instanceof Image) {
    return null;
    // [LIGHT]
    // additional code needed for full version
  }
  return super.replaceObject(obj);
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

public Object replaceObject(Object obj) throws IOException {
  if (obj instanceof Image) {
    return null;
    // [LIGHT]
    // additional code needed for full version
  }
  return super.replaceObject(obj);
}

代码示例来源:origin: in.jlibs/org-openide-util

public Object replaceObject(Object obj) throws IOException {
  if (obj instanceof Image) {
    return null;
    // [LIGHT]
    // additional code needed for full version
  }
  return super.replaceObject(obj);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public Object replaceObject (Object obj) throws IOException {
  if (obj instanceof Image) {
    return null;
    // [LIGHT]
    // additional code needed for full version
  }
  return super.replaceObject(obj);
}

代码示例来源:origin: org.apache.wicket/com.springsource.org.apache.wicket

protected Object replaceObject(Object obj) throws IOException
  {
    if (obj instanceof Component)
    {
      String name = ((Component)obj).getPath();
      replacedComponents.put(name, obj);
      return name;
    }
    return super.replaceObject(obj);
  }
}

代码示例来源:origin: org.apache.wicket/wicket-core

@Override
  protected Object replaceObject(Object obj) throws IOException
  {
    if (obj instanceof Component)
    {
      final Component component = (Component)obj;
      String name = component.getPath();
      replacedComponents.put(name, component);
      return name;
    }
    return super.replaceObject(obj);
  }
}

代码示例来源:origin: SpigotMC/Spigot-API

@Override
  protected Object replaceObject(Object obj) throws IOException {
    if (!(obj instanceof Serializable) && (obj instanceof ConfigurationSerializable)) {
      obj = Wrapper.newWrapper((ConfigurationSerializable) obj);
    }

    return super.replaceObject(obj);
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

@Override
  protected Object replaceObject(Object obj) throws IOException
  {
    if (obj instanceof Component)
    {
      final Component component = (Component)obj;
      String name = component.getPath();
      replacedComponents.put(name, component);
      return name;
    }
    return super.replaceObject(obj);
  }
}

代码示例来源:origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
  @Nullable @Override protected Object replaceObject(Object o) throws IOException {
    return o == null || MarshallerExclusions.isExcluded(o.getClass()) ? null :
      o.getClass().equals(Object.class) ? new JdkMarshallerDummySerializable() : super.replaceObject(o);
  }
}

代码示例来源:origin: org.gridgain/gridgain-core

/** {@inheritDoc} */
  @Nullable @Override protected Object replaceObject(Object o) throws IOException {
    return o == null || GridMarshallerExclusions.isExcluded(o.getClass()) ? null :
      o.getClass().equals(Object.class) ? new GridJdkMarshallerDummySerializable() : super.replaceObject(o);
  }
}

代码示例来源:origin: teiid/teiid

@Override
  protected Object replaceObject(Object obj) throws IOException {
    if (obj instanceof ExceptionHolder) {
      count.incrementAndGet();
    }
    return super.replaceObject(obj);
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/org.ops4j.pax.wicket.service

@Override
  protected Object replaceObject(Object object)
    throws IOException {
    if (object instanceof BundleContext) {
      BundleContext context = (BundleContext) object;
      return new ReplaceBundleContext(context);
    } else if (object instanceof Bundle) {
      Bundle bundle = (Bundle) object;
      return new ReplaceBundle(bundle);
    } else {
      return super.replaceObject(object);
    }
  }
}

代码示例来源:origin: ops4j/org.ops4j.pax.wicket

@Override
  protected Object replaceObject(Object object)
    throws IOException {
    if (object instanceof BundleContext) {
      BundleContext context = (BundleContext) object;
      return new ReplaceBundleContext(context);
    } else if (object instanceof Bundle) {
      Bundle bundle = (Bundle) object;
      return new ReplaceBundle(bundle);
    } else {
      return super.replaceObject(object);
    }
  }
}

代码示例来源:origin: org.ops4j.pax.wicket/pax-wicket-service

@Override
  protected Object replaceObject(Object object)
    throws IOException {
    if (object instanceof BundleContext) {
      BundleContext context = (BundleContext) object;
      return new ReplaceBundleContext(context);
    } else if (object instanceof Bundle) {
      Bundle bundle = (Bundle) object;
      return new ReplaceBundle(bundle);
    } else {
      return super.replaceObject(object);
    }
  }
}

代码示例来源:origin: org.teiid/teiid-client

return super.replaceObject(obj);

相关文章

ObjectOutputStream类方法