fileutil.java

来自「无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上」· Java 代码 · 共 38 行

JAVA
38
字号
// Copyright (c) 2003 Jython projectpackage org.python.core;import java.io.ByteArrayOutputStream;import java.io.InputStream;import java.io.IOException;/** * Utility methods for Java file handling. */public class FileUtil{    /**     * Read all bytes from the input stream.     *     * Note that using this method to read very large streams could     * cause out-of-memory exceptions and/or block for large periods     * of time.     */    public static byte[] readBytes( InputStream in )	throws IOException    {	final int bufsize = 8192; // nice buffer size used in JDK	byte[] buf = new byte[ bufsize ];	ByteArrayOutputStream out =	    new ByteArrayOutputStream( bufsize );	int count;	while( true )	{	    count = in.read( buf, 0, bufsize );	    if ( count < 0 )		break;	    out.write( buf, 0, count );	}	return out.toByteArray();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?