当前位置: 首页>>代码示例>>Java>>正文


Java ObjectInputValidation类代码示例

本文整理汇总了Java中java.io.ObjectInputValidation的典型用法代码示例。如果您正苦于以下问题:Java ObjectInputValidation类的具体用法?Java ObjectInputValidation怎么用?Java ObjectInputValidation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObjectInputValidation类属于java.io包,在下文中一共展示了ObjectInputValidation类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readObject

import java.io.ObjectInputValidation; //导入依赖的package包/类
/**
* @param in the input stream to read from
* @exception IOException error during read
* @exception ClassNotFoundException when class not found
*/
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException, java.lang.ClassNotFoundException {
    in.defaultReadObject();

    in.registerValidation(
        new ObjectInputValidation() {
            public void validateObject() {
                if (attr.getClass() == DefaultAttributes.class) {
                    Impl impl = new Impl(LocalFileSystem.this);
                    attr = new InnerAttrs(LocalFileSystem.this, impl, impl, impl);
                }
            }
        }, 0
    );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:LocalFileSystem.java

示例2: pasteObject

import java.io.ObjectInputValidation; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public T pasteObject() {
    
    try {
        ByteArrayInputStream bai = new ByteArrayInputStream(objectHolder);
        ObjectInputStream oi = new ObjectInputStream(bai);
        T resourceList = (T) oi.readObject();
        if (resourceList instanceof ObjectInputValidation) {
            ((ObjectInputValidation) resourceList).validateObject();
        }
        
        return resourceList;
    } catch (Exception e) {
        throw new RuntimeException("Failed To Paste Object", e); //$NON-NLS-1$
    }
}
 
开发者ID:Verigreen,项目名称:verigreen,代码行数:17,代码来源:ObjectCopier.java

示例3: readObject

import java.io.ObjectInputValidation; //导入依赖的package包/类
/**
 * Overridden to properly register component documents with the creole
 * register when this compound is deserialized.
 */
private void readObject(ObjectInputStream stream) throws IOException,
    ClassNotFoundException {
  stream.defaultReadObject();
  // register a validation callback to add our child documents
  // to the creole register and fire the relevant events. This
  // is what the Factory would do if the children were loaded in
  // the normal way.
  stream.registerValidation(new ObjectInputValidation() {
    public void validateObject() {
      for(Document d : documents.values()) {
        Gate.getCreoleRegister().get(d.getClass().getName())
            .addInstantiation(d);
        Gate.getCreoleRegister().resourceLoaded(
            new CreoleEvent(d, CreoleEvent.RESOURCE_LOADED));
      }
    }
  }, 0);
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:23,代码来源:AbstractCompoundDocument.java

示例4: readObject

import java.io.ObjectInputValidation; //导入依赖的package包/类
private void readObject (ObjectInputStream ois) throws ClassNotFoundException, IOException {
    ois.defaultReadObject ();
    ois.registerValidation(new ObjectInputValidation() {
        public void validateObject() throws InvalidObjectException {
            warnedFiles.add(getFileImpl());
        }
    }, 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DataEditorSupport.java

示例5: createObjectInputStream

import java.io.ObjectInputValidation; //导入依赖的package包/类
/**
 * Creates an ObjectInputStream that deserializes a stream of objects from a reader using XStream. <h3>Example</h3>
 * 
 * <pre>
 * ObjectInputStream in = xstream.createObjectOutputStream(aReader);
 * int a = out.readInt();
 * Object b = out.readObject();
 * Object c = out.readObject();
 * </pre>
 * 
 * @see #createObjectOutputStream(com.thoughtworks.xstream.io.HierarchicalStreamWriter, String)
 * @since 1.0.3
 */
public ObjectInputStream createObjectInputStream(final HierarchicalStreamReader reader) throws IOException {
    return new CustomObjectInputStream(new CustomObjectInputStream.StreamCallback() {
        @Override
        public Object readFromStream() throws EOFException {
            if (!reader.hasMoreChildren()) {
                throw new EOFException();
            }
            reader.moveDown();
            final Object result = unmarshal(reader);
            reader.moveUp();
            return result;
        }

        @Override
        public Map<String, Object> readFieldsFromStream() throws IOException {
            throw new NotActiveException("not in call to readObject");
        }

        @Override
        public void defaultReadObject() throws NotActiveException {
            throw new NotActiveException("not in call to readObject");
        }

        @Override
        public void registerValidation(final ObjectInputValidation validation, final int priority)
                throws NotActiveException {
            throw new NotActiveException("stream inactive");
        }

        @Override
        public void close() {
            reader.close();
        }
    }, classLoaderReference);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:49,代码来源:XStream.java

示例6: createObjectInputStream

import java.io.ObjectInputValidation; //导入依赖的package包/类
/**
 * Creates an ObjectInputStream that deserializes a stream of objects from a reader using XStream.
 *
 * @see #createObjectOutputStream(com.thoughtworks.xstream.io.HierarchicalStreamWriter, String)
 * @see #createObjectInputStream(com.thoughtworks.xstream.io.HierarchicalStreamReader)
 * @since 1.4.10
 */
public ObjectInputStream createObjectInputStream(final HierarchicalStreamReader reader, final DataHolder dataHolder)
        throws IOException {
    return new CustomObjectInputStream(new CustomObjectInputStream.StreamCallback() {
        @Override
        public Object readFromStream() throws EOFException {
            if (!reader.hasMoreChildren()) {
                throw new EOFException();
            }
            reader.moveDown();
            final Object result = unmarshal(reader, dataHolder);
            reader.moveUp();
            return result;
        }

        @Override
        public Map<String, Object> readFieldsFromStream() throws IOException {
            throw new NotActiveException("not in call to readObject");
        }

        @Override
        public void defaultReadObject() throws NotActiveException {
            throw new NotActiveException("not in call to readObject");
        }

        @Override
        public void registerValidation(final ObjectInputValidation validation, final int priority)
                throws NotActiveException {
            throw new NotActiveException("stream inactive");
        }

        @Override
        public void close() {
            reader.close();
        }
    }, classLoaderReference);
}
 
开发者ID:x-stream,项目名称:xstream,代码行数:44,代码来源:XStream.java

示例7: readObject

import java.io.ObjectInputValidation; //导入依赖的package包/类
private void readObject(ObjectInputStream s) throws IOException {

            final int LOW_PRIORITY = -5;
            final int MEDIUM_PRIORITY = 0;
            final int HIGH_PRIORITY = 5;

            s.registerValidation(new ObjectInputValidation() {
                public void validateObject() {
                    log.actual("validateObject() medium priority 1");
                }
            }, MEDIUM_PRIORITY);

            s.registerValidation(new ObjectInputValidation() {
                public void validateObject() {
                    log.actual("validateObject() high priority");
                }
            }, HIGH_PRIORITY);

            s.registerValidation(new ObjectInputValidation() {
                public void validateObject() {
                    log.actual("validateObject() low priority");
                }
            }, LOW_PRIORITY);

            s.registerValidation(new ObjectInputValidation() {
                public void validateObject() {
                    log.actual("validateObject() medium priority 2");
                }
            }, MEDIUM_PRIORITY);
        }
 
开发者ID:x-stream,项目名称:xstream,代码行数:31,代码来源:SerializationCallbackOrderTest.java

示例8: createObjectInputStream

import java.io.ObjectInputValidation; //导入依赖的package包/类
public ObjectInputStream createObjectInputStream(final HierarchicalStreamReader paramHierarchicalStreamReader)
{
  return new CustomObjectInputStream(new CustomObjectInputStream.StreamCallback()
  {
    public void close()
    {
      paramHierarchicalStreamReader.close();
    }

    public void defaultReadObject()
    {
      throw new NotActiveException("not in call to readObject");
    }

    public Map readFieldsFromStream()
    {
      throw new NotActiveException("not in call to readObject");
    }

    public Object readFromStream()
    {
      if (!paramHierarchicalStreamReader.hasMoreChildren())
        throw new EOFException();
      paramHierarchicalStreamReader.moveDown();
      Object localObject = XStream.this.unmarshal(paramHierarchicalStreamReader);
      paramHierarchicalStreamReader.moveUp();
      return localObject;
    }

    public void registerValidation(ObjectInputValidation paramAnonymousObjectInputValidation, int paramAnonymousInt)
    {
      throw new NotActiveException("stream inactive");
    }
  }
  , this.classLoaderReference);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:37,代码来源:XStream.java

示例9: createObjectInputStream

import java.io.ObjectInputValidation; //导入依赖的package包/类
/**
    * Creates an ObjectInputStream that deserializes a stream of objects from a reader using XStream.
    *
    * <h3>Example</h3>
    * <pre>ObjectInputStream in = xstream.createObjectOutputStream(aReader);
    * int a = out.readInt();
    * Object b = out.readObject();
    * Object c = out.readObject();</pre>
    *
    * @see #createObjectOutputStream(com.thoughtworks.xstream.io.HierarchicalStreamWriter, String)
    * @since 1.0.3
    */
public ObjectInputStream createObjectInputStream(
		final HierarchicalStreamReader reader) throws IOException {
	return new CustomObjectInputStream(
			new CustomObjectInputStream.StreamCallback() {
				public Object readFromStream() throws EOFException {
					if (!reader.hasMoreChildren()) {
						throw new EOFException();
					}
					reader.moveDown();
					Object result = unmarshal(reader);
					reader.moveUp();
					return result;
				}

				public Map readFieldsFromStream() throws IOException {
					throw new NotActiveException(
							"not in call to readObject");
				}

				public void defaultReadObject() throws NotActiveException {
					throw new NotActiveException(
							"not in call to readObject");
				}

				public void registerValidation(
						ObjectInputValidation validation, int priority)
						throws NotActiveException {
					throw new NotActiveException("stream inactive");
				}

				public void close() {
					reader.close();
				}
			});
}
 
开发者ID:reflexworks,项目名称:reflexcore,代码行数:48,代码来源:XStream.java

示例10: registerValidation

import java.io.ObjectInputValidation; //导入依赖的package包/类
void registerValidation(ObjectInputValidation validation, int priority)
throws NotActiveException, InvalidObjectException;
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:3,代码来源:CustomObjectInputStream.java

示例11: registerValidation

import java.io.ObjectInputValidation; //导入依赖的package包/类
public final synchronized void registerValidation(ObjectInputValidation obj,
                                                  int prio)
    throws NotActiveException, InvalidObjectException{
    // XXX I18N, logging needed.
    throw new Error("Method registerValidation not supported");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:IIOPInputStream.java

示例12: registerValidation

import java.io.ObjectInputValidation; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void registerValidation(ObjectInputValidation obj, int pri) {
    // No-op.
}
 
开发者ID:apache,项目名称:ignite,代码行数:5,代码来源:OptimizedObjectInputStream.java

示例13: registerValidation

import java.io.ObjectInputValidation; //导入依赖的package包/类
public void registerValidation(ObjectInputValidation paramObjectInputValidation, int paramInt)
{
  peekCallback().registerValidation(paramObjectInputValidation, paramInt);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:5,代码来源:CustomObjectInputStream.java


注:本文中的java.io.ObjectInputValidation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。