當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。