锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲一区综合在线播放,亚洲国产成人久久99精品,国产亚洲真人做受在线观看http://www.tkk7.com/andyBlog/Powered By Andyzh-cnSun, 11 May 2025 02:09:10 GMTSun, 11 May 2025 02:09:10 GMT60嫻嬭瘯clonehttp://www.tkk7.com/andyBlog/archive/2011/12/26/367164.htmlPowered By AndyPowered By AndyMon, 26 Dec 2011 02:54:00 GMThttp://www.tkk7.com/andyBlog/archive/2011/12/26/367164.htmlhttp://www.tkk7.com/andyBlog/comments/367164.htmlhttp://www.tkk7.com/andyBlog/archive/2011/12/26/367164.html#Feedback0http://www.tkk7.com/andyBlog/comments/commentRss/367164.htmlhttp://www.tkk7.com/andyBlog/services/trackbacks/367164.htmlpackage cn.xx

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * <pre>
 * @Types   role : 嫻嬭瘯clone

 * @Create  time : 2011-12-26 : 涓婂崍10:49:39
 * @ver     curr : 1.0
 * </pre>
 */
public class TestClone implements Serializable{

    private static final long serialVersionUID = -7340886443308126418L;

    /**
     * <pre>
     * @Methods role : 瀵硅薄鐨凜lone
     * 娉? 瑕乧lone瀵硅薄蹇呴』瑕佸疄鐜癝erializable鎺ュ彛,銆涓嶇劧鎶汵oSerializableException
     * </pre>
     * @param obj
     * @return
     * @throws IOException
     * @throws ClassNotFoundException
     * @Create  time : 2011-12-23 : 涓嬪崍5:26:57
     * @ver     curr : 1.0
     */
    @SuppressWarnings("unchecked")
    public static <T> T invokeCopy(T obj) throws IOException, ClassNotFoundException{
        //T newObj = null;
        // write object to memory
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(obj);
        oos.flush();
        
        // read object come from memory
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        //newObj = (T)ois.readObject();
        
        //bis.close();
        //oos.close();
        // return clone object
        return (T)ois.readObject();
        
        
    }
    
    /**
     * <pre>
     * @Methods role : 瀹炵幇瀵硅薄鐨刢lone
     * 涓ょ鏂規(浜岄変竴瀹炵幇閮藉彲浠?:
     * 1: 瀹炵幇Cloneable鎺ュ彛,銆娣卞害clone鑷繁閲嶅啓clone()瀹炵幇,姝ゆ柟娉曞彧瀹炵幇嫻呭害clone
     * 2: 瀹炵幇Serializable鎺ュ彛
     * @param obj
     * @return
     * @throws NoSuchMethodException
     * @throws SecurityException
     * @throws IllegalAccessException
     * @throws IllegalArgumentException
     * @throws InvocationTargetException
     * @throws ClassNotFoundException
     * @throws IOException
     * @throws CloneNotSupportedException
     * @Create  time : 2011-12-26 : 涓婂崍10:31:37
     * @ver     curr : 1.0
     * </pre>
     */
    public static<T> T clone(T obj) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, IOException, CloneNotSupportedException{
        // is null
        if(null == obj) return null;
        
        // is instanceof Cloneable
        if(obj instanceof Cloneable){
            return invokeClone(obj);
        }
        // is instanceof Serializable
        else if(obj instanceof Serializable){
            return invokeCopy(obj);
        }
        
        // is not supported clone
        throw new java.lang.CloneNotSupportedException();
    }

    @SuppressWarnings("unchecked")
    public static <T> T invokeClone(T obj) throws NoSuchMethodException,
            IllegalAccessException, InvocationTargetException {
        Class<? extends Object> classObject = obj.getClass();
        Method method = classObject.getDeclaredMethod("clone");
        return (T)method.invoke(obj);
    }
    
    public static void main(String[] args) throws ClassNotFoundException, IOException {
        String x = "123";
        String v = invokeCopy(x);
        
        String[][] array = {{"1", "2"},{ "3", "2","2","3"},{"V","3"}}, array2;
        
        
        System.out.println(x);
        System.out.println(v);
        array2 = invokeCopy(array);
        System.out.println(Arrays.deepToString(array2));
        
        int[] a = {1,48,2}, b = {1, 20, 19};
        System.out.println("a --- hashCode: " + a.hashCode() + "---b: hashCode:" + b.hashCode());
        b = invokeCopy(a);
        System.out.println(b.hashCode());
        System.out.println(Arrays.toString(b));
        short age = 25;
        Person p = new TestClone(). new Person(1l, "andy", age), ps, pe;
        
        ps = invokeCopy(p);
        
        System.out.println(ps);
        
        try {
            //pe = clone(p);
            pe = invokeClone(p);
            System.out.println(pe);
        } catch (NoSuchMethodException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SecurityException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
    class Person implements Serializable{//, Cloneable{
        private static final long serialVersionUID = 7605971168826706980L;
        private Long id;
        private String name;
        private short age;
        
        
        public Person() {
        }
        
        
        public Person(Long id, String name, short age) {
            super();
            this.id = id;
            this.name = name;
            this.age = age;
        }


        public Long getId() {
            return id;
        }
        public void setId(Long id) {
            this.id = id;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public short getAge() {
            return age;
        }
        public void setAge(short age) {
            this.age = age;
        }


        public String toString() {
            return "Person [id=" + id + ", name=" + name + ", age=" + age + "]";
        }
        
        /*protected Object clone() throws CloneNotSupportedException {
            // TODO Auto-generated method stub
            return super.clone();
        }*/
        
    }
}

Powered By Andy 2011-12-26 10:54 鍙戣〃璇勮
]]>
涓轟粈涔堣鍏抽棴鍜宨o嫻?/title><link>http://www.tkk7.com/andyBlog/archive/2011/11/18/364193.html</link><dc:creator>Powered By Andy</dc:creator><author>Powered By Andy</author><pubDate>Fri, 18 Nov 2011 02:09:00 GMT</pubDate><guid>http://www.tkk7.com/andyBlog/archive/2011/11/18/364193.html</guid><wfw:comment>http://www.tkk7.com/andyBlog/comments/364193.html</wfw:comment><comments>http://www.tkk7.com/andyBlog/archive/2011/11/18/364193.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/andyBlog/comments/commentRss/364193.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/andyBlog/services/trackbacks/364193.html</trackback:ping><description><![CDATA[package cn.webmctv.test;<br /><br />import java.io.File;<br />import java.io.FileInputStream;<br />import java.io.FileNotFoundException;<br />import java.io.IOException;<br />import java.io.InputStream;<br /><br />public class TestInputStream {<br /><br />    public static void main(String[] args) {<br />        /* 涓轟粈涔堣鍏抽棴鍜宨o嫻? 鐢變簬java搴曞眰鏄敤c瀹炵幇鐨勶紝銆鎵浠ュ綋鎴戜滑涓嶅仠鐨勮皟鐢╪ew InputStream -> impl <br />         * 鏃跺欙紝銆c鎵撳紑鐨勬枃浠朵細涓鐩存病鏈夊叧闂紝鑰屽鑷存枃浠跺垹闄や笉浜嗭紝鍒殑紼嬪簭璁塊棶涓嶄簡鐨勯棶棰橈紝鍜屾搷浣滅郴緇熸墦寮鏂囦歡<br />         * 瓚呰繃鏈澶ф暟寮傚父銆傝屼笅闈ew FileInputStream(new File("c:/q.txt"));榪欑鏂瑰紡娌℃湁鍏抽棴c鎵撳紑鐨?br />         * 鏂囦歡涓鐩磏ew 灝變細鍑虹幇鎵撳紑鏂囦歡澶寮傚父銆?br />        short count = 0;<br />        InputStream inStream = null;<br />            try {<br />                for (int i = 0; i < Short.MAX_VALUE; i++) {<br />                    //inStream.<br />                    inStream = new FileInputStream(new File("/root/install.log"));<br />                    //count ++;<br />                    System.out.println("count: " + count++);<br />                }<br />                //p.load(inStream);<br />            } catch (FileNotFoundException e) {<br />                // TODO Auto-generated catch block<br />                e.printStackTrace();<br />            } finally{<br />                if(inStream != null) try{ inStream.close(); } catch(IOException e){};<br />            }<br />        <br />        System.out.println(Short.MAX_VALUE);<br />        */<br />        short count = 0;<br />        InputStream inStream = null;<br />        for (int i = 0; i < Short.MAX_VALUE; i++) {<br />            try {<br />                    //inStream.<br />                    inStream = new FileInputStream(new File("/root/install.log"));<br />                    //count ++;<br />                    System.out.println("count: " + count++);<br />                <br />                //p.load(inStream);<br />            } catch (FileNotFoundException e) {<br />                // TODO Auto-generated catch block<br />                e.printStackTrace();<br />            } finally{<br />                if(inStream != null) try{ inStream.close(); } catch(IOException e){};<br />            }<br />        }<br />        <br />        System.out.println(Short.MAX_VALUE);<br />        <br />    }<br />}<br /><img src ="http://www.tkk7.com/andyBlog/aggbug/364193.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/andyBlog/" target="_blank">Powered By Andy</a> 2011-11-18 10:09 <a href="http://www.tkk7.com/andyBlog/archive/2011/11/18/364193.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓や釜鍙橀噺涓嶉氳繃絎笁涓彉閲忎氦鎹㈠?/title><link>http://www.tkk7.com/andyBlog/archive/2010/03/27/316683.html</link><dc:creator>Powered By Andy</dc:creator><author>Powered By Andy</author><pubDate>Sat, 27 Mar 2010 03:12:00 GMT</pubDate><guid>http://www.tkk7.com/andyBlog/archive/2010/03/27/316683.html</guid><wfw:comment>http://www.tkk7.com/andyBlog/comments/316683.html</wfw:comment><comments>http://www.tkk7.com/andyBlog/archive/2010/03/27/316683.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/andyBlog/comments/commentRss/316683.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/andyBlog/services/trackbacks/316683.html</trackback:ping><description><![CDATA[<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><span style="color: #0000ff">package</span><span style="color: #000000"> cn.coder.y2010.m03.d27;<br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /><br /> <img id="Codehighlighter1_33_58_Open_Image" onclick="this.style.display='none'; Codehighlighter1_33_58_Open_Text.style.display='none'; Codehighlighter1_33_58_Closed_Image.style.display='inline'; Codehighlighter1_33_58_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_33_58_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_33_58_Closed_Text.style.display='none'; Codehighlighter1_33_58_Open_Image.style.display='inline'; Codehighlighter1_33_58_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" /></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_33_58_Closed_Text">/** */</span><span id="Codehighlighter1_33_58_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /> * 涓や釜鍙橀噺涓嶉氳繃絎笁涓彉閲忎氦鎹㈠?br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" /> </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /> <img id="Codehighlighter1_88_266_Open_Image" onclick="this.style.display='none'; Codehighlighter1_88_266_Open_Text.style.display='none'; Codehighlighter1_88_266_Closed_Image.style.display='inline'; Codehighlighter1_88_266_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_88_266_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_88_266_Closed_Text.style.display='none'; Codehighlighter1_88_266_Open_Image.style.display='inline'; Codehighlighter1_88_266_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" /></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> SwitchIntValue </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_88_266_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_88_266_Open_Text"><span style="color: #000000">{<br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /><br /> <img id="Codehighlighter1_134_264_Open_Image" onclick="this.style.display='none'; Codehighlighter1_134_264_Open_Text.style.display='none'; Codehighlighter1_134_264_Closed_Image.style.display='inline'; Codehighlighter1_134_264_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" /><img style="display: none" id="Codehighlighter1_134_264_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_134_264_Closed_Text.style.display='none'; Codehighlighter1_134_264_Open_Image.style.display='inline'; Codehighlighter1_134_264_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" />    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> main(String[] args) </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_134_264_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_134_264_Open_Text"><span style="color: #000000">{<br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> i </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">5</span><span style="color: #000000">,j </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #000000">3</span><span style="color: #000000">;<br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />    i </span><span style="color: #000000">=</span><span style="color: #000000"> i </span><span style="color: #000000">+</span><span style="color: #000000"> j; </span><span style="color: #008000">//</span><span style="color: #008000"> 5 + 3;</span><span style="color: #008000"><br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">    j </span><span style="color: #000000">=</span><span style="color: #000000"> i </span><span style="color: #000000">-</span><span style="color: #000000"> j; </span><span style="color: #008000">//</span><span style="color: #008000"> 8 - 3;</span><span style="color: #008000"><br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">    i </span><span style="color: #000000">=</span><span style="color: #000000"> i </span><span style="color: #000000">-</span><span style="color: #000000"> j; </span><span style="color: #008000">//</span><span style="color: #008000"> 8 - 5;</span><span style="color: #008000"><br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">    System.out.println(i </span><span style="color: #000000">+</span><span style="color: #000000"> </span><span style="color: #000000">"</span><span style="color: #000000"> - : - </span><span style="color: #000000">"</span><span style="color: #000000"> </span><span style="color: #000000">+</span><span style="color: #000000"> j);<br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />    }</span></span><span style="color: #000000"><br /> <img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span></div> <img src ="http://www.tkk7.com/andyBlog/aggbug/316683.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/andyBlog/" target="_blank">Powered By Andy</a> 2010-03-27 11:12 <a href="http://www.tkk7.com/andyBlog/archive/2010/03/27/316683.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>MD5鍒濊Вhttp://www.tkk7.com/andyBlog/archive/2010/02/25/MD5.htmlPowered By AndyPowered By AndyThu, 25 Feb 2010 12:46:00 GMThttp://www.tkk7.com/andyBlog/archive/2010/02/25/MD5.htmlhttp://www.tkk7.com/andyBlog/comments/313948.htmlhttp://www.tkk7.com/andyBlog/archive/2010/02/25/MD5.html#Feedback0http://www.tkk7.com/andyBlog/comments/commentRss/313948.htmlhttp://www.tkk7.com/andyBlog/services/trackbacks/313948.html 1    public static String md5(String pwd) throws NoSuchAlgorithmException {
 2
 3    StringBuilder sb = new StringBuilder();
 4    MessageDigest digest = MessageDigest.getInstance("md5");
 5    byte[] b = digest.digest(pwd.getBytes());
 6    // 涓?6榪涘埗榪涜涓?br />  7    // 16 59 1011001
 8    // 59>>>4&0xf 101 | 59&0xf 1011001
 9    // &1111 | &00001111
10    // 緇撴灉 101 | 00001001
11    // 16榪涘埗 5 9
12    for (byte s : b) {
13        // 宸﹁竟鐨勫洓浣?101
14        //sb.append(Character.forDigit(
15        //    ((s >>> 4) & 0xf) > 4 ? (s >>> 4) & 0xf ^ 0xe
16        //        : (s >>> 4) & 0xf, 16));
17        sb.append(Character.forDigit((s >>> 4& 0xf16));
18        // 鍙寵竟鐨勫洓浣?001
19        sb.append(Character.forDigit(s & 0xf16));
20    }

21    // 鎵鏈塎D5鐨勭敓闈?-f涔嬮棿鐨勫瓧姣嶄笌鏁板瓧
22    return sb.toString().toUpperCase();
23    }


Powered By Andy 2010-02-25 20:46 鍙戣〃璇勮
]]>
URL緙栫爜http://www.tkk7.com/andyBlog/archive/2010/02/22/313660.htmlPowered By AndyPowered By AndyMon, 22 Feb 2010 10:57:00 GMThttp://www.tkk7.com/andyBlog/archive/2010/02/22/313660.htmlhttp://www.tkk7.com/andyBlog/comments/313660.htmlhttp://www.tkk7.com/andyBlog/archive/2010/02/22/313660.html#Feedback0http://www.tkk7.com/andyBlog/comments/commentRss/313660.htmlhttp://www.tkk7.com/andyBlog/services/trackbacks/313660.html闃呰鍏ㄦ枃

Powered By Andy 2010-02-22 18:57 鍙戣〃璇勮
]]>
JAVA 搴忓垪鍖?/title><link>http://www.tkk7.com/andyBlog/archive/2010/01/22/310559.html</link><dc:creator>Powered By Andy</dc:creator><author>Powered By Andy</author><pubDate>Fri, 22 Jan 2010 12:52:00 GMT</pubDate><guid>http://www.tkk7.com/andyBlog/archive/2010/01/22/310559.html</guid><wfw:comment>http://www.tkk7.com/andyBlog/comments/310559.html</wfw:comment><comments>http://www.tkk7.com/andyBlog/archive/2010/01/22/310559.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/andyBlog/comments/commentRss/310559.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/andyBlog/services/trackbacks/310559.html</trackback:ping><description><![CDATA[<p>package cn.test;</p> <p>import java.io.File;<br /> import java.io.FileInputStream;<br /> import java.io.FileNotFoundException;<br /> import java.io.FileOutputStream;<br /> import java.io.IOException;<br /> import java.io.ObjectInputStream;<br /> import java.io.ObjectOutputStream;<br /> import java.io.Serializable;</p> <p>public class TestSeralizable implements Serializable{</p> <p>    private static final long serialVersionUID = -2495488416590182981L;</p> <p>    /**<br />      * 淇濆瓨搴忓垪鍖栫殑瀵瑰儚<br />      * @param path<br />      * @param o<br />      */<br />     public void writeObject(String path, Object o){<br />  File file = new File(path);<br />  if(file.exists()){<br />      file.delete();<br />  }<br />  <br />  FileOutputStream stream = null;<br />  ObjectOutputStream outputStream = null;<br />  <br />  try {<br />      stream = new FileOutputStream(file);<br />      outputStream = new ObjectOutputStream(stream);<br />      outputStream.writeObject(o);<br />  } catch (IOException e) {<br />      // TODO Auto-generated catch block<br />      e.printStackTrace();<br />  } finally{<br />      try {<br />   stream.close();<br />   outputStream.close();<br />      } catch (IOException e) {<br />   // TODO Auto-generated catch block<br />   e.printStackTrace();<br />      } finally{<br />   stream = null;<br />   outputStream = null;<br />      }<br />  }<br />  <br />     }<br />     <br />     /**<br />      * 璇誨彇搴忓垪鍖栧鍍?br />      * @param <T><br />      * @param path<br />      * @return<br />      */<br />     @SuppressWarnings("unchecked")<br />     public <T> T  readObject(String path){<br />  File file = new File(path);<br />  if(!file.exists()){<br />      return null;<br />  }<br />  FileInputStream stream = null;<br />  ObjectInputStream inputStream = null;<br />  <br />  try {<br />      stream = new FileInputStream(file);<br />      inputStream = new ObjectInputStream(stream);<br />      <br />      return  (T)inputStream.readObject();<br />  } catch (FileNotFoundException e) {<br />      // TODO Auto-generated catch block<br />      e.printStackTrace();<br />  } catch (IOException e) {<br />      // TODO Auto-generated catch block<br />      e.printStackTrace();<br />  } catch (ClassNotFoundException e) {<br />      // TODO Auto-generated catch block<br />      e.printStackTrace();<br />  } finally{<br />      try {<br />   stream.close();<br />   inputStream.close();<br />      } catch (IOException e) {<br />   // TODO Auto-generated catch block<br />   e.printStackTrace();<br />      } finally{<br />   stream = null;<br />   inputStream = null;<br />      }<br />  }<br />  <br />  return null;<br />     }<br />     <br />     public static void main(String[] args) {<br />  // ---------------  鍒涘緩搴忓垪鍖栧疄渚?nbsp;  ----------------------//<br />  <br />  TestSeralizable test = new TestSeralizable();<br />  TestSeralizable.UserBean user = new TestSeralizable().new UserBean();<br />  user.setName("wkw");<br />  user.setAge(24);<br />  user.setEmail("wkw11@163.com");<br />  user.setPassword("123");<br />  <br />  // ---------------  淇濆瓨搴忓垪鍖栧疄渚?nbsp;  ----------------------//<br />  test.writeObject("c:/qq.tmp", user);<br />  <br />  // ---------------  璇誨彇搴忓垪鍖栧疄渚?nbsp;  ----------------------//<br />  UserBean unSeralizableObject = test.readObject("c:/qq.tmp");<br />  System.out.println(unSeralizableObject);<br />     }<br />     <br />     /**<br />      * 鍐呴儴綾?br />      * @author Administrator<br />      *<br />      */<br />     public class UserBean  implements Serializable{</p> <p>     private String name;<br />      private String password;<br />      private Integer age;<br />      private String email;<br />      <br />      <br />      <br />      /**<br />       * <br />       */<br />      public UserBean() {<br />   super();<br />   // TODO Auto-generated constructor stub<br />      }</p> <p> </p> <p>     /**<br />       * @param name<br />       * @param password<br />       * @param age<br />       * @param email<br />       */<br />      public UserBean(String name, String password, Integer age, String email) {<br />   super();<br />   this.name = name;<br />   this.password = password;<br />   this.age = age;<br />   this.email = email;<br />      }</p> <p> </p> <p>     public String getName() {<br />          return name;<br />      }</p> <p> </p> <p>     public void setName(String name) {<br />          this.name = name;<br />      }</p> <p> </p> <p>     public String getPassword() {<br />          return password;<br />      }</p> <p> </p> <p>     public void setPassword(String password) {<br />          this.password = password;<br />      }</p> <p> </p> <p>     public Integer getAge() {<br />          return age;<br />      }</p> <p> </p> <p>     public void setAge(Integer age) {<br />          this.age = age;<br />      }</p> <p> </p> <p>     public String getEmail() {<br />          return email;<br />      }</p> <p> </p> <p>     public void setEmail(String email) {<br />          this.email = email;<br />      }</p> <p><br />      </p> <p>     private static final long serialVersionUID = 7645220056029053735L;</p> <p> </p> <p>     @Override<br />      public String toString() {<br />   // TODO Auto-generated method stub<br />   return "[" + this.name + "," + this.password + "," + this.age + "," + this.email +"]";<br />      }</p> <p> </p> <p><br />  }<br /> }<br /> </p> <img src ="http://www.tkk7.com/andyBlog/aggbug/310559.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/andyBlog/" target="_blank">Powered By Andy</a> 2010-01-22 20:52 <a href="http://www.tkk7.com/andyBlog/archive/2010/01/22/310559.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://24aabb.com" target="_blank">亚洲小说区图片区另类春色</a>| <a href="http://2828228.com" target="_blank">99精品国产免费久久久久久下载 </a>| <a href="http://yyfass.com" target="_blank">香蕉视频在线观看亚洲</a>| <a href="http://bjtjchem.com" target="_blank">一级毛片免费播放试看60分钟</a>| <a href="http://8888kkk.com" target="_blank">国产精品va无码免费麻豆</a>| <a href="http://930mk.com" target="_blank">国产成+人+综合+亚洲专</a>| <a href="http://aaa99999.com" target="_blank">免费观看无遮挡www的小视频</a>| <a href="http://cnepu.com" target="_blank">亚洲视频国产视频</a>| <a href="http://www5xsq.com" target="_blank">无码免费一区二区三区免费播放</a>| <a href="http://359777b.com" target="_blank">久久青青草原亚洲AV无码麻豆</a>| <a href="http://ksyanhui.com" target="_blank">中文字幕免费观看视频</a>| <a href="http://oakuu.com" target="_blank">亚洲成AV人片在线观看无</a>| <a href="http://xsdin.com" target="_blank">久久精品电影免费动漫</a>| <a href="http://yy6636.com" target="_blank">亚洲熟妇色自偷自拍另类</a>| <a href="http://abbobo.com" target="_blank">中字幕视频在线永久在线观看免费</a>| <a href="http://7299jj.com" target="_blank">亚洲日产2021三区</a>| <a href="http://seosuanfa.com" target="_blank">无码永久免费AV网站</a>| <a href="http://ur5r2kr.com" target="_blank">亚洲AV无码一区二区大桥未久</a>| <a href="http://www44xixi.com" target="_blank">日本高清免费不卡视频</a>| <a href="http://chch12.com" target="_blank">一级特黄特色的免费大片视频</a>| <a href="http://junfurui.com" target="_blank">亚洲色偷拍另类无码专区</a>| <a href="http://zzhjnmzp.com" target="_blank">96免费精品视频在线观看</a>| <a href="http://tzkanglong.com" target="_blank">亚洲综合色区中文字幕</a>| <a href="http://by11gun.com" target="_blank">四虎影视精品永久免费</a>| <a href="http://gg596gg.com" target="_blank">水蜜桃视频在线观看免费播放高清</a>| <a href="http://txa6.com" target="_blank">亚洲欧洲免费视频</a>| <a href="http://xx16xx.com" target="_blank">免费福利网站在线观看</a>| <a href="http://newbuybay.com" target="_blank">亚洲国产成人精品无码区花野真一</a>| <a href="http://taoh2517.com" target="_blank">吃奶摸下高潮60分钟免费视频</a>| <a href="http://tttui.com" target="_blank">中国国产高清免费av片</a>| <a href="http://cn-zggx.com" target="_blank">亚洲欧洲日产韩国在线</a>| <a href="http://xyxpx.com" target="_blank">无码国模国产在线观看免费</a>| <a href="http://7778kk.com" target="_blank">一区二区在线视频免费观看</a>| <a href="http://bjsunic.com" target="_blank">久久精品国产96精品亚洲 </a>| <a href="http://www44wawa.com" target="_blank">精品日韩亚洲AV无码</a>| <a href="http://dajiaody.com" target="_blank">免费成人激情视频</a>| <a href="http://930mk.com" target="_blank">深夜特黄a级毛片免费播放</a>| <a href="http://yiren2233.com" target="_blank">亚洲中文字幕无码久久2017</a>| <a href="http://477077.com" target="_blank">99久久免费观看</a>| <a href="http://tzfzs.com" target="_blank">亚洲国产欧美国产综合一区</a>| <a href="http://webgame86.com" target="_blank">国产L精品国产亚洲区久久 </a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>