GokuaiBase/src/main/java/com/gokuai/base/utils/Base64.java
public static Object decodeToObject(String encodedObject, int options, final ClassLoader loader) throws IOException, ClassNotFoundException {

		// Decode and gunzip if necessary
		byte[] objBytes = decode(encodedObject, options);

		java.io.ByteArrayInputStream bais = null;
		java.io.ObjectInputStream ois = null;
		Object obj = null;

		try {
			bais = new java.io.ByteArrayInputStream(objBytes);

			// If no custom class loader is provided, use Java's builtin OIS.
			if (loader == null) {
				ois = new java.io.ObjectInputStream(bais);
			} // end if: no loader provided

			// Else make a customized object input stream that uses
			// the provided class loader.
			else {
				ois = new java.io.ObjectInputStream(bais) {
					@Override
					public Class<?> resolveClass(java.io.ObjectStreamClass streamClass) throws IOException, ClassNotFoundException {
						Class<?> c = Class.forName(streamClass.getName(), false, loader);
						if (c == null) {
							return super.resolveClass(streamClass);
						} else {
							return c; // Class loader knows of this class.
						} // end else: not null
					} // end resolveClass
				}; // end ois
			} // end else: no custom class loader

			obj = ois.readObject();
		} // end try
		catch (IOException e) {
			throw e; // Catch and throw in order to execute finally{}
		} // end catch
		catch (ClassNotFoundException e) {
			throw e; // Catch and throw in order to execute finally{}
		} // end catch
		finally {
			try {
				bais.close();
			} catch (Exception e) {
			}
			try {
				ois.close();
			} catch (Exception e) {
			}
		} // end finally

		return obj;
	}
/**
	 * Decode to object.
	 *
	 * @param encodedObject
	 *            the encoded object
	 * @param options
	 *            the options
	 * @param loader
	 *            the loader
	 *
	 * @return the object
	 *
	 * @throws IOException
	 *             Signals that an I/O exception has occurred.
	 * @throws ClassNotFoundException
	 *             the class not found exception
	 */
Decode to object.
@param encodedObject
the encoded object
@param options
the options
@param loader
the loader

@return the object

@throws IOException
Signals that an I/O exception has occurred.
@throws ClassNotFoundException
the class not found exception
Decode to object . @param encodedObject the encoded object @param options the options @param loader the loader @return the object @throws IOException Signals that an I / O exception has occurred . @throws ClassNotFoundException the class not found exception
public static Object decodeToObject(String encodedObject, int options, final ClassLoader loader) throws IOException, ClassNotFoundException {
		byte[] objBytes = decode(encodedObject, options);
		java.io.ByteArrayInputStream bais = null;
		java.io.ObjectInputStream ois = null;
		Object obj = null;
		try {
			bais = new java.io.ByteArrayInputStream(objBytes);
			if (loader == null) {
				ois = new java.io.ObjectInputStream(bais);
			} 
			else {
				ois = new java.io.ObjectInputStream(bais) {
					@Override
					public Class<?> resolveClass(java.io.ObjectStreamClass streamClass) throws IOException, ClassNotFoundException {
						Class<?> c = Class.forName(streamClass.getName(), false, loader);
						if (c == null) {
							return super.resolveClass(streamClass);
						} else {
							return c; 
						} 
					} 
				}; 
			} 
			obj = ois.readObject();
		} 
		catch (IOException e) {
			throw e; 
		} 
		catch (ClassNotFoundException e) {
			throw e; 
		} 
		finally {
			try {
				bais.close();
			} catch (Exception e) {
			}
			try {
				ois.close();
			} catch (Exception e) {
			}
		} 
		return obj;
	}
public static Object decodeToObject ( String encodedObject , int options , final ClassLoader loader ) throws IOException , ClassNotFoundException { byte [ ] objBytes = decode ( encodedObject , options ) ; java . io . ByteArrayInputStream bais = null ; java . io . ObjectInputStream ois = null ; Object obj = null ; try { bais = new java . io . ByteArrayInputStream ( objBytes ) ; if ( loader == null ) { ois = new java . io . ObjectInputStream ( bais ) ; } else { ois = new java . io . ObjectInputStream ( bais ) { @ Override public Class < ? > resolveClass ( java . io . ObjectStreamClass streamClass ) throws IOException , ClassNotFoundException { Class < ? > c = Class . forName ( streamClass . getName ( ) , false , loader ) ; if ( c == null ) { return super . resolveClass ( streamClass ) ; } else { return c ; } } } ; } obj = ois . readObject ( ) ; } catch ( IOException e ) { throw e ; } catch ( ClassNotFoundException e ) { throw e ; } finally { try { bais . close ( ) ; } catch ( Exception e ) { } try { ois . close ( ) ; } catch ( Exception e ) { } } return obj ; }
Decode to object.
Decode to object .
// Decode and gunzip if necessary // If no custom class loader is provided, use Java's builtin OIS. // end if: no loader provided // Else make a customized object input stream that uses // the provided class loader. // Class loader knows of this class. // end else: not null // end resolveClass // end ois // end else: no custom class loader // end try // Catch and throw in order to execute finally{} // end catch // Catch and throw in order to execute finally{} // end catch // end finally