parent
fb82de6182
commit
4784ea4f25
@ -1,32 +1,36 @@
|
|||||||
package cn.jyjz.xiaoyao.common.base.util;
|
package cn.jyjz.xiaoyao.common.base.util;
|
||||||
|
|
||||||
|
|
||||||
import com.sun.xml.messaging.saaj.util.ByteOutputStream;
|
import com.sun.xml.messaging.saaj.util.ByteOutputStream;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.util.List;
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ObjectUtils {
|
public class ObjectUtils extends org.springframework.util.ObjectUtils {
|
||||||
|
|
||||||
|
public static boolean isNotEmpty(Object obj) {
|
||||||
|
return !isEmpty(obj);
|
||||||
|
}
|
||||||
|
|
||||||
public static Object clone(Map obj){
|
public static Object clone(Map obj) {
|
||||||
Object cloneObj = null;
|
Object cloneObj = null;
|
||||||
ByteOutputStream bos = new ByteOutputStream();
|
ByteOutputStream bos = new ByteOutputStream();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ObjectOutputStream oss = new ObjectOutputStream(bos);
|
ObjectOutputStream oss = new ObjectOutputStream(bos);
|
||||||
oss.writeObject(obj);
|
oss.writeObject(obj);
|
||||||
oss.close();
|
oss.close();
|
||||||
|
|
||||||
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
|
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
|
||||||
ObjectInputStream ois = new ObjectInputStream(bis);
|
ObjectInputStream ois = new ObjectInputStream(bis);
|
||||||
cloneObj = ois.readObject();
|
cloneObj = ois.readObject();
|
||||||
ois.close();
|
ois.close();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cloneObj;
|
return cloneObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue