Java 8 ObjectStreamClass - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ObjectStreamClass class.

This code example shows how to use the following methods:forClass, getName
        writeByte(STREAM_VERSION);
    } 
 
    @Override 
    protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
        if (desc.getName().equals(EXCEPTION_CLASSNAME)) {
            write(TYPE_EXCEPTION);
        } else if (desc.getName().equals(STACKTRACEELEMENT_CLASSNAME)) {
            write(TYPE_STACKTRACEELEMENT);
        } else { 
            Class<?> clazz = desc.forClass();
            if (clazz.isPrimitive() || clazz.isArray()) {
                write(TYPE_FAT_DESCRIPTOR);
                super.writeClassDescriptor(desc);
            } else { 
                write(TYPE_THIN_DESCRIPTOR);
                writeUTF(desc.getName());
            } 
        } 
    } 

8
CodeRank
This code example shows how to use the following methods:forClass, getName, getSerialVersionUID
        writeByte(STREAM_VERSION);
    } 
 
    @Override 
    protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
        Class<?> clazz = desc.forClass();
        if (clazz.isPrimitive() || clazz.isArray() || clazz.isInterface() ||
            desc.getSerialVersionUID() == 0) {
            write(TYPE_FAT_DESCRIPTOR);
            super.writeClassDescriptor(desc);
        } else { 
            write(TYPE_THIN_DESCRIPTOR);
            writeUTF(desc.getName());
        } 
    } 
} 
8
CodeRank
This code example shows how to use the following methods:forClass, getName
        writeByte(STREAM_VERSION);
    } 
 
    @Override 
    protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
        if (desc.getName().equals(EXCEPTION_CLASSNAME)) {
            write(TYPE_EXCEPTION);
        } else if (desc.getName().equals(STACKTRACEELEMENT_CLASSNAME)) {
            write(TYPE_STACKTRACEELEMENT);
        } else { 
            Class<?> clazz = desc.forClass();
            if (clazz.isPrimitive() || clazz.isArray()) {
                write(TYPE_FAT_DESCRIPTOR);
                super.writeClassDescriptor(desc);
            } else { 
                write(TYPE_THIN_DESCRIPTOR);
                writeUTF(desc.getName());
            } 
        } 
    } 

7
CodeRank
This code example shows how to use the following methods:getName
	@Override 
	protected Class<?> resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
		try { 
			if (this.classLoader != null) {
				// Use the specified ClassLoader to resolve local classes. 
				return ClassUtils.forName(classDesc.getName(), this.classLoader);
			} 
			else { 
				// Use the default ClassLoader... 
				return super.resolveClass(classDesc);
			} 
		} 
		catch (ClassNotFoundException ex) {
			return resolveFallbackIfPossible(classDesc.getName(), ex);
		} 
	} 
 
	@Override 
	protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
		if (!this.acceptProxyClasses) {
6
CodeRank
This code example shows how to use the following methods:getName
    } 
 
    @Override 
    protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
        try { 
            return loader.loadClass(desc.getName());
        } catch (ClassNotFoundException e) {
            return super.resolveClass(desc);
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getName
	} 
 
	@Override 
	protected Class<?> resolveClass(ObjectStreamClass objectstreamclass) throws IOException, ClassNotFoundException {
		Class<?> result = null;
		if(objectstreamclass.getName().equals("er.extensions.ERXMutableArray")) {
			return ERXMutableArray.class; 
		} 
		if(objectstreamclass.getName().equals("er.extensions.ERXMutableDictionary")) {
			return ERXMutableDictionary.class; 
		} 
		if(objectstreamclass.getName().equals("er.extensions.ERXKeyGlobalID")) {
			return ERXKeyGlobalID.class; 
		} 
		result = super.resolveClass(objectstreamclass);
		return result;
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:forClass, getName
	} 
 
	@Override 
	protected void writeClassDescriptor(ObjectStreamClass desc) throws IOExceptionClass<?> clazz = desc.forClass();
		if( clazz.isPrimitive() || clazz.isArray() )
		{ 
			write(0);
			super.writeClassDescriptor(desc);
		} 
		else 
		{ 
			write(1);
			writeUTF(desc.getName());
		} 
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getName
        _loader = loader;
    } 
 
    @Override 
	protected Class<?> resolveClass(ObjectStreamClass objectStreamClass) throws ClassNotFoundException {
    	return Class.forName(objectStreamClass.getName(), false, _loader); //Fix: Prevayler version should be like this one.
    } 
} 
6
CodeRank
This code example shows how to use the following methods:forClass, getName, getSerialVersionUID
        writeByte(STREAM_VERSION);
    } 
 
    @Override 
    protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {
        Class<?> clazz = desc.forClass();
        if (clazz.isPrimitive() || clazz.isArray() || clazz.isInterface() ||
            desc.getSerialVersionUID() == 0) {
            write(TYPE_FAT_DESCRIPTOR);
            super.writeClassDescriptor(desc);
        } else { 
            write(TYPE_THIN_DESCRIPTOR);
            writeUTF(desc.getName());
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getName
      this.classLoader = classLoader;
    } 
     
    @Override 
    protected Class<?> resolveClass(ObjectStreamClass desc) throws ClassNotFoundException {
      return Class.forName(desc.getName(), false, classLoader);
    } 
     
  } 
   
} 
6
CodeRank
See Code Examples for Java 8 ObjectStreamClass Methods: