public static void main(String[] args) { // TODO Auto-generated method stub new Thread(new Runnable(){ @Override public void run() { // TODO Auto-generated method stub
new MyClient3(); } }).start(); }
public void MyClient3method(ClipboardUtil.MyImgTextContent mydata){ try { ClipboardUtil.MyImgTextContent t = new ClipboardUtil.MyImgTextContent(); for(String s : mydata) { if(s.startsWith("text")) { t.content.add(s); } else { File f = new File(s.replaceFirst("img-", "")); byte[] bs = new byte[(int)f.length()]; FileInputStream fis = new FileInputStream(f); fis.read(bs); StringBuilder sb = new StringBuilder(); for(byte b : bs) { sb.append(b + ","); } t.content.add("img-" + sb.toString()); fis.close(); } } s.writeObj(t); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.net.URL;import javax.swing.ImageIcon; import javax.swing.JTextPane; import javax.swing.text.BadLocationException; import javax.swing.text.Element; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument;public class MyJTextPane extends JTextPane {
private static final long serialVersionUID = 4343203173373020324L; public MyJTextPane(boolean editable) { this.setEditable(editable); if(editable) { this.addKeyListener(new KeyListener() {
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;import javax.imageio.ImageIO;/**
* 剪切板工具类
*
* @author NeverChange
*
*/
public class ClipboardUtil { private static List<MyAbstractClipboardProccess> ps = new ArrayList<MyAbstractClipboardProccess>();
public static final String TEMP_PATH; static {
TEMP_PATH = System.getProperty("java.io.tmpdir") + "MyClipboardTemp";
File f = new File(TEMP_PATH);
if (!f.exists()) {
f.mkdir();
} else if (!f.isDirectory()) {
f.delete();
f = new File(TEMP_PATH);
f.mkdir();
} ps.add(new MyAbstractClipboardProccess() { /**
*
*/
private static final long serialVersionUID = 1L; public boolean isSupport(Object content) {
return content.toString().trim().startsWith("<html")
|| content.toString().trim().startsWith("<HTML");
} public MyImgTextContent getContent(Object content) {
content = content.toString().trim().replaceAll("(\r|\n)+", "")
.replaceAll("<!--(.)*?-->", "").replaceAll("<!(.)*?>",
"").replaceAll("<style>.*?</style>", "")
.replaceAll("<STYLE>.*?</STYLE>", "").replaceAll(
"</p>", "\n").replaceAll("</P>", "\n")
.replaceAll("<br>", "\n").replaceAll("<br/>", "\n")
.replaceAll("<IMG", "<img").replaceAll(
"<(?!img).*?(/)?>", "")
.replaceAll("</.+?>", ""); MyImgTextContent mtc = new MyImgTextContent();
for (String str : content.toString().split("<")) {
if (str.startsWith("img")) {
mtc.put("img", saveImgToMyTemp(str.split("file:///")[1]
.split("\"")[0]));
if (!str.endsWith(">")) {
mtc.put("text", escapeHtml(str.split(">")[str
.split(">").length - 1]));
}
} else {
if (!"".equals(str)) {
mtc.put("text", escapeHtml(str.split("file:///")[0]
.split("\"")[0]));
}
}
} return mtc;
} });// 默认剪切板处理类, 支持解析word&qq
ps.add(new MyAbstractClipboardProccess() { /**
*
*/
private static final long serialVersionUID = 1L; public boolean isSupport(Object content) {
return content instanceof java.awt.image.BufferedImage;
} public MyImgTextContent getContent(Object content) {
MyImgTextContent mtc = new MyImgTextContent();
mtc.put("img", saveImgToMyTemp((BufferedImage) content));
return mtc;
} });// 剪切板图片处理类, 支持解析word&qq截图
ps.add(new MyAbstractClipboardProccess() { /**
*
*/
private static final long serialVersionUID = 1L; public boolean isSupport(Object content) {
return content instanceof java.lang.String;
} public MyImgTextContent getContent(Object content) {
MyImgTextContent mtc = new MyImgTextContent();
mtc.put("text", content.toString());
return mtc;
} });// 剪切板文字处理类, 支持解析word&qq
// 使用ps.add();相应的实现类扩展其他软件的支持
} /**
* 封装剪切板图文混排内容
*
* @author NeverChange
*
*/
public static class MyImgTextContent implements Iterable<String>,
Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String MyObjNum = "";
private String MyObjRole = ""; /**
*
*/
public MyImgTextContent() {
// TODO Auto-generated constructor stub
} public String getMyObjNum() {
return MyObjNum;
} public void setMyObjNum(String myObjNum) {
MyObjNum = myObjNum;
} public String getMyObjRole() {
return MyObjRole;
}
public void setMyObjRole(String myobjRole) {
MyObjRole = myobjRole;
}
List<String> content = new ArrayList<String>(); public void put(String type, String content) {
this.content.add(type + "-" + content);
} public int hashCode() {
return content.hashCode();
} public boolean equals(Object obj) {
return content.equals(obj);
} public String toString() {
StringBuffer str = new StringBuffer();
int ct = 0;
for (String c : content) {
str.append("\n" + (ct++) + " : " + c);
} return str.toString();
} public Iterator<String> iterator() {
return content.iterator();
} } public static abstract class MyAbstractClipboardProccess implements
Serializable {
/**
*
*/
private static final long serialVersionUID = 1L; public abstract boolean isSupport(Object content);
public abstract MyImgTextContent getContent(Object content); public static void fileCopy(File source, File target) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(target); int ct = 0;
byte[] bs = new byte[1024 * 8];
while (-1 != (ct = fis.read(bs))) {
fos.write(bs, 0, ct);
}
fis.close();
} catch (Exception e) {
if (null != fis) {
try {
fis.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
e.printStackTrace();
}
} public String escapeHtml(String html) {
return null == html ? null : html.replaceAll("\\"", "\"")
.replaceAll("\\&", "&").replaceAll("\\<", "<")
.replaceAll("\\>", ">").replaceAll("\\ ", " ");
} public String saveImgToMyTemp(String path) {
try {
File source = new File(path);
if (source.exists() && source.isFile()) {
File target = new File(TEMP_PATH + "\\"
+ UUID.randomUUID().toString() + "."
+ path.split("\\.")[path.split("\\.").length - 1]);
target.createNewFile();
this.fileCopy(source, target);
return target.getPath();
}
} catch (IOException e) {
e.printStackTrace();
} return null;
} public String saveImgToMyTemp(BufferedImage img) {
try {
File target = new File(TEMP_PATH + "\\"
+ UUID.randomUUID().toString() + ".jpg");
target.createNewFile();
FileOutputStream fos = new FileOutputStream(target);
ImageIO.write(img, "jpg", fos);
fos.flush();
fos.close();
return target.getPath();
} catch (Exception e) {
e.printStackTrace();
} return null;
} } public static MyImgTextContent getMyImgTextContentFromClipboard() {
Clipboard sysc = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable cc = sysc.getContents(null); for (DataFlavor df : sysc.getAvailableDataFlavors()) {
try {
for (MyAbstractClipboardProccess mcpi : ps) {
if (mcpi.isSupport(cc.getTransferData(df))) {
return mcpi.getContent(cc.getTransferData(df));
}
}
} catch (UnsupportedFlavorException e) {
e.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
} return null;
} public static void main(String[] args) {
MyImgTextContent mtc = getMyImgTextContentFromClipboard();
}}import java.net.UnknownHostException;public class GetMyUserIP {
public static String getMyIP(){
String Objip = "";
try {
Objip = java.net.InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//////"当前C端发送数据时IP地址为:"+Objip);
return Objip;
}
}
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.UIManager;public class MyClient3 extends JFrame{
/**
* 欢迎大家使用这个源码 如有疑问请加qq群:151648295
*
*/
/**
* @param args
*/
private static final long serialVersionUID = -6927612627246594189L;
private MyJTextPane jtp1;
private MyJTextPane jtp2;
private JButton jb; SocketClient s;
ObjectOutputStream oos;
public MyClient3() {
super("不改原创");
s=new SocketClient("192.168.1.3",9999);
this.setLayout(new GridLayout(3, 1));
jtp1 = new MyJTextPane(false);
jtp2 = new MyJTextPane(true);
jtp2.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
jb = new JButton("send");
jb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jtp1.setContent(jtp2.getContent());
ClipboardUtil.MyImgTextContent mydata = jtp2.getContent();
mydata.setMyObjRole("Mem");
mydata.setMyObjNum("0");
MyClient3method(mydata);
jtp2.setText("");
jtp2.grabFocus();
}
});
this.add(new JScrollPane(jtp1, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane. HORIZONTAL_SCROLLBAR_NEVER));
this.add(new JScrollPane(jtp2, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane. HORIZONTAL_SCROLLBAR_NEVER));
this.add(jb);
this.setSize(400, 600);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Thread(new Runnable(){
@Override
public void run() {
// TODO Auto-generated method stub
new MyClient3();
}
}).start();
}
public void MyClient3method(ClipboardUtil.MyImgTextContent mydata){
try {
ClipboardUtil.MyImgTextContent t = new ClipboardUtil.MyImgTextContent();
for(String s : mydata) {
if(s.startsWith("text")) {
t.content.add(s);
} else {
File f = new File(s.replaceFirst("img-", ""));
byte[] bs = new byte[(int)f.length()];
FileInputStream fis = new FileInputStream(f);
fis.read(bs);
StringBuilder sb = new StringBuilder();
for(byte b : bs) {
sb.append(b + ",");
}
t.content.add("img-" + sb.toString());
fis.close();
}
}
s.writeObj(t);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.net.URL;import javax.swing.ImageIcon;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.Element;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;public class MyJTextPane extends JTextPane {
private static final long serialVersionUID = 4343203173373020324L; public MyJTextPane(boolean editable) {
this.setEditable(editable);
if(editable) {
this.addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
}
});
}
}
public void cut() {
} public void copy() {
try {
throw new RuntimeException();
} catch (Exception e) {
e.printStackTrace();
}
} public void paste() {
if(this.isEditable()) {
try {
StyledDocument doc = MyJTextPane.this.getStyledDocument();
for(String content : ClipboardUtil.getMyImgTextContentFromClipboard()) {
if(null == content) {
continue;
} else if(content.startsWith("text-")) {
String str = content.replaceFirst("text-", "");
doc.insertString(MyJTextPane.this.getCaretPosition(), str, null);
MyJTextPane.this.grabFocus();
} else if(content.startsWith("img-")) {
MyJTextPane.this.insertIcon(new ImageIcon(new URL("file:///" + content.replaceFirst("img-", ""))));
MyJTextPane.this.grabFocus();
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
public void setContent(ClipboardUtil.MyImgTextContent mitc) {
try {
StyledDocument doc = MyJTextPane.this.getStyledDocument();
for(String content : mitc) {
if(null == content) {
continue;
} else if(content.startsWith("text-")) {
String str = content.replaceFirst("text-", "");
doc.insertString(doc.getLength(), str, null);
} else if(content.startsWith("img-")) {
MyJTextPane.this.setCaretPosition(doc.getLength());
MyJTextPane.this.insertIcon(new ImageIcon(new URL("file:///" + content.replaceFirst("img-", ""))));
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
public ClipboardUtil.MyImgTextContent getContent() {
ClipboardUtil.MyImgTextContent mitc = new ClipboardUtil.MyImgTextContent(); StyledDocument doc = MyJTextPane.this.getStyledDocument();
for(int i = 0; i < doc.getLength(); i++) {
Element e = doc.getCharacterElement(i);
if(e.getName().equals("content")) {
try {
mitc.put("text", MyJTextPane.this.getText(i, 1));
} catch (BadLocationException e1) {
e1.printStackTrace();
}
} else if(e.getName().equals("icon")) {
mitc.put("img", e.getAttributes().getAttribute(StyleConstants.CharacterConstants.IconAttribute).toString().replaceFirst("file:/", ""));
}
}
return mitc;
}}
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileOutputStream;
import java.net.Socket;
import java.util.UUID;import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.UIManager;public class MyServer3 extends JFrame{
private static final long serialVersionUID = -6927612627246594189L;
private static MyJTextPane jtp1;
private MyJTextPane jtp2;
private JButton jb;
static int MyLover = 0; public static void main(String[] args) {
new MyServer3();
start();
}
public static void start(){
try {
SocketServer ss=new SocketServer(9999);
Socket s=ss.nextSocket();
while(true) {
final ClipboardUtil.MyImgTextContent mydata=(ClipboardUtil.MyImgTextContent)ss.readObject(s);
ClipboardUtil.MyImgTextContent mylocaldata = new ClipboardUtil.MyImgTextContent();
for(String c : mydata){
if(c.startsWith("text")) {
mylocaldata.content.add(c);
} else {
String filePath = "D:/" + UUID.randomUUID() + ".jpg";
String[] sss = c.replaceAll("img-", "").split(",");
byte[] bs = new byte[sss.length];
for(int i = 0; i < bs.length; i++) {
bs[i] = Byte.parseByte(sss[i]);
}
File f = new File(filePath);
f.createNewFile();
FileOutputStream fos = new FileOutputStream(f);
fos.write(bs);
fos.flush();
fos.close();
mylocaldata.content.add("img-" + filePath);
}
}
jtp1.setContent(mylocaldata);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public MyServer3(){
super("不改原创");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
this.setLayout(new GridLayout(3, 1));
jtp1 = new MyJTextPane(false);
jtp2 = new MyJTextPane(true);
jtp2.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
jb = new JButton("send");
jb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jtp1.setContent(jtp2.getContent());
jtp2.setText("");
jtp2.grabFocus();
}
});
this.add(new JScrollPane(jtp1, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane. HORIZONTAL_SCROLLBAR_NEVER));
this.add(new JScrollPane(jtp2, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane. HORIZONTAL_SCROLLBAR_NEVER));
this.add(jb);
this.setSize(400, 600);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}}
import java.io.*;//服务器端程序
public class Server {
private static BufferedWriter out = null;
private static BufferedReader in = null;
String mySysusernum = "";
String mySysuserRole = "";
int mySysfilenum = 0;
public Server(String myusernum,String myuserrole,int myfilenum) throws IOException{
int port = 4331;
ServerSocket server = null;
Socket you = null;
mySysusernum = myusernum;
mySysuserRole = myuserrole;
mySysfilenum = myfilenum;
server = new ServerSocket(port);// 建立服务器端套接字
while (true) {// 不停地监听客户端请求
you = server.accept();// 接受请求
out = new BufferedWriter(new OutputStreamWriter(you
.getOutputStream()));
in = new BufferedReader(new InputStreamReader(you.getInputStream()));
service();// 提供服务
if (you != null)
you.close();// 关闭套接字
}
} public void get() throws IOException {
/* 客户端上传文件时的处理方法。与客户端的put()方法在功能上相辅相成,同时使用 */
String fileName = in.readLine();// 读取客户端发过来的第一条消息
if (fileName.equals("cancel")) {// 若客户端取消了上传请求,则返回
return;
} else {
fileName = ChatServer.MySysUserPicFileFolder + File.separator + mySysuserRole + File.separator + mySysusernum+File.separator+mySysfilenum+".txt";
File file = new File(fileName);// 客户端没有取消上传请求,则第一条消息是上传
// 至服务器的文件的绝对路径
File parent = file.getParentFile();// 判断该文件的父目录
if (!parent.exists()) {// 若父目录不存在,建立父目录
parent.mkdirs();
}
String s = "";
BufferedWriter writer = new BufferedWriter(new FileWriter(file));// 建立输出流
while ((s = in.readLine()).endsWith("1")) {// 判断读入的一行是否以“1”结尾,若
// 是,则文件没有传输完,若以“0”结尾,则表示文件传输完成
writer.write(s.substring(0, s.length() - 1));// 将所读取的一行数据写入文
// 件,但改行数据最后有一个“1”,这是认为加的,应删去
writer.newLine();// 换行
}
out.write("上传成功!!\n");// 向客户端返回“上传成功”的消息
out.flush();// 排空缓存
writer.flush();
writer.close();// 关闭本地输出文件流
MyServer3.MyLover=1;
}
} public static void put() throws IOException {
/* 客户端下载文件时的处理方法,与客户端get()方法同时使用 */
String fileName = in.readLine();
File file = new File(fileName);
if (!file.exists()) {// 判断客户端请求的文件是否存在,若不存在向客户端发送
// "not exists"消息
out.write("not exists!\n");
out.flush();
} else {
out.write("wait\n");// 向客户端发“wait”消息,告诉客户端所请求的文件存在
out.flush();
String s = "";
BufferedReader reader = new BufferedReader(new FileReader(fileName));// 输入流
while ((s = reader.readLine()) != null) {
out.write(s + "1\n");// 数字1 意在告诉客户端文件没有到末尾
out.flush();
}
out.write("0\n");// 数字0 意在告诉客户端文件已传输完
out.flush();
reader.close();
}
} public void service() throws IOException {// 处理客户端的请求
String order = in.readLine();
if (order.equals("PUT")) {// 判断客户端所申请的服务类型,“上传文件”或“下载文件”
get();// 上传文件处理方法
} else if (order.equals("GET")) {
put();// 下载文件处理方法
}
}
}
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
public class SocketClient {
public Socket getS() {
return s;
}
public void setS(Socket s) {
this.s = s;
}
private Socket s;
private InputStream in;
private OutputStream out;
private BufferedInputStream inByte;
private OutputStream outByte;
private BufferedReader inStr;
private PrintWriter outStr;
public ObjectOutputStream oos = null;
public ObjectInputStream ois = null;
private long size = 0;
public SocketClient(String ip, int port) {
try {
s = new Socket(ip, port);
in = s.getInputStream();
out = s.getOutputStream();
inByte = new BufferedInputStream(in);
outByte = out;
oos = new ObjectOutputStream(s.getOutputStream());
ois = new ObjectInputStream(s.getInputStream());
inStr = new BufferedReader(new InputStreamReader(in));
outStr = new PrintWriter(new OutputStreamWriter(out));
} catch (Exception e) {
e.printStackTrace();
}
}
public Object readObj(){
Object obj = null;
try {
obj = ois.readObject();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return obj;
}
public void writeObj(Object obj){
try {
oos.writeObject(obj);
oos.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String readStr() throws IOException {
synchronized (this.in) {
return this.inStr.readLine();
}
}
public void writeStr(String content,String MyThreadname) {
synchronized (this.out) {
String IP = GetMyUserIP.getMyIP();
outStr.println(content+"丗"+IP+"丗"+MyThreadname);
outStr.flush();
}
}
public File readToFile(File file) throws IOException {
synchronized (this.in) {
FileOutputStream fos = new FileOutputStream(file);
byte[] temp = new byte[1024 * 8];
int count = 0;
while (-1 != (count = this.inByte.read(temp))) {
fos.write(temp, 0, count);
fos.flush();
}
fos.close();
return file;
}
}
public void writeFile(File file) {
synchronized (this.out) {
size = file.length();
this.noticeFileSize(size);
FileInputStream fis;
try {
fis = new FileInputStream(file);
byte[] temp = new byte[1024 * 8];
int count = 0;
while (-1 != (count = fis.read(temp))) {
this.outByte.write(temp, 0, count);
this.outByte.flush();
}
fis.close();
} catch (Exception e) {
e.printStackTrace();
}
// long progress = 0;
// while (size != (progress = getServerReceiveSize())) {
// //////"progress : " + (progress / (size / 100)) + "%");
// }
}
}
private void noticeFileSize(long l) {
String str = l + "";
int j = 19 - str.length();
for (int i = 0; i < j; i++) {
str = "0" + str;
}
this.writeByByte(str);
}
protected void writeByByte(String content) {
synchronized (this.out) {
try {
this.out.write(content.getBytes());
this.out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private long getServerReceiveSize() {
synchronized (in) {
byte[] b = new byte[19];
try {
this.in.read(b);
} catch (IOException e) {
e.printStackTrace();
}
return Long.parseLong(new String(b));
}
}
public String getProgress() {
long l = this.getServerReceiveSize() / (size / 100);
if(100 == l) {
return null;
}
return l + " %";
}
public void getMyResourceBack(){
if(inStr!=null){
try {
inStr.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}if(outStr!=null){
outStr.close();
}
if(s!=null){
try {
s.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}if(in!=null){
try {
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}if(out!=null){
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}