📄 streameater.java
字号:
/* * This file is part of MobiMon. * * MobiMon is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * MobiMon 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 General Public License for more details. * You should have received a copy of the GNU General Public License * along with MobiMon; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* * StreamEater.java * * Created on March 12, 2003, 6:00 PM */package mobimon.common;import java.io.*;/** * * @author jan */public class StreamEater implements Runnable { private InputStream is; private StringBuffer sb; private boolean done; /** Creates a new instance of StreamEater */ public StreamEater(InputStream is) { this.is = is; sb = new StringBuffer(); done = false; } public void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(is)); String temp = null; while((temp = in.readLine()) != null){ sb.append(temp).append('\n'); } is.close(); done = true; } catch(Exception e){ e.printStackTrace(); } } public byte[] getBytes() { while (!done); return sb.toString().getBytes(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -