Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.marshalling.serialization.java;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.security.AccessController;
import java.security.PrivilegedAction;
import org.jboss.marshalling.ClassResolver;
import org.jboss.marshalling.ClassTable;
import org.jboss.marshalling.Externalizer;
import org.jboss.marshalling.ObjectResolver;
import org.jboss.marshalling.ObjectTable;
import org.jboss.marshalling.StreamHeader;
import org.jboss.marshalling.ClassExternalizerFactory;
import static org.jboss.marshalling.serialization.java.JavaSerializationConstants.*;
/**
* @author Ron Sigal
* @version $Revision: 1.1 $
*
* Copyright Sep 19, 2008
*
*/
public class JavaSerializationOutputStream extends ObjectOutputStream
{
private static boolean privateFieldsAndMethodsSetForStreamHeader;
private static boolean privateFieldsAndMethodsSetForWriteOverride;
private static Field boutField;
private static Field depthField;
private static Field enableOverrideField;
private static Field handlesField;
private static Field subsField;
private static Method clearMethod;
private static Method verifySubclassMethod;
private static Method writeFatalExceptionMethod;
private static Method writeObject0Method;
private static Class> blockDataOutputStreamClass;
private static Constructor> blockDataOutputStreamConstructor;
private static Method setBlockDataModeMethod;
private static Class> handleTableClass;
private static Constructor> handleTableConstructor;
private static Class> replaceTableClass;
private static Constructor> replaceTableConstructor;
private static Field getAccessibleDeclaredField(final Class> clazz, final String name) {
return AccessController.doPrivileged(new PrivilegedAction() {
public Field run() {
try {
final Field field = clazz.getDeclaredField(name);
field.setAccessible(true);
return field;
} catch (NoSuchFieldException e) {
throw new NoSuchFieldError(e.getMessage());
}
}
});
}
private static Method getAccessibleDeclaredMethod(final Class> clazz, final String name, final Class>... paramTypes) {
return AccessController.doPrivileged(new PrivilegedAction() {
public Method run() {
try {
final Method method = clazz.getDeclaredMethod(name, paramTypes);
method.setAccessible(true);
return method;
} catch (NoSuchMethodException e) {
throw new NoSuchMethodError(e.getMessage());
}
}
});
}
private static Constructor getAccessibleDeclaredConstructor(final Class> clazz, final Class>... paramTypes) {
return AccessController.doPrivileged(new PrivilegedAction() {
public Constructor run() {
try {
final Constructor constructor = clazz.getDeclaredConstructor(paramTypes);
constructor.setAccessible(true);
return constructor;
} catch (NoSuchMethodException e) {
throw new NoSuchMethodError(e.getMessage());
}
}
});
}
private Map