接受图片通过Jfilechooser保存

                    JFileChooser jfc=new JFileChooser();  
                    jfc.setSelectedFile(new File(jfc.getCurrentDirectory().getAbsolutePath(),name));  
                    jfc.showSaveDialog(frame);  
                    File f=jfc.getSelectedFile();  
                    f.createNewFile();  
                    dis=new DataInputStream(scoket.getInputStream());  
                    RandomAccessFile raf=new RandomAccessFile(f,"rw");   
                    byte[] buf=new byte[2048];   
                    int num=0;   
                    while((num=dis.read(buf))!=(-1))   
                    {   
                     raf.write(buf,0,num);  
                    raf.skipBytes(num);  
                    }   
                    br.close();  
                    dis.close();  
                    raf.close(); 
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lz12366007/archive/2009/10/28/4740238.aspx

你可能感兴趣的:(.net,F#,Blog)