public void saveBit(InputStream inStream) throws IOException{ ByteArrayOutputStream outStream = new ByteArrayOutputStream(); //创建一个Buffer字符串 byte[] buffer = new byte[1024]; //每次读取的字符串长度,如果为-1,代表全部读取完毕 int len = 0; //使用一个输入流从buffer里把数据读取出来 while( (len
//方法一(每次只读取一个字节) public static void getFile() throws IOException { File file = new File("D:\\a.txt"); FileInputStream fileinputstream = new FileInputStream(file); int data = fileinputstream.read(); int data1 = fileinputstream.read(); System.out.
Sub CreateGoalPictures() '声明变量 Dim Wb As Workbook Dim Sht As Worksheet Dim Shp As Shape Dim Pic, EndRow Dim FilePath, StudentName '设置变量 Set Wb = Application.ThisWorkbook Set Sht = Wb.Worksheets(1) With Sht EndRow = .Cells(.Cells.Rows.Count, 1).End(xl
写文件大家出现最多的是汉字知码之类的问题,今天不是乱码问题,是出现在大量空字符,用记事本打开是不可见的.如果用NodePad++打开则会显示NUL 问题分题: 刚开始以为是编码问题,试了几个编码发现问题依旧.后来发现在就在最后出来空字符应该是在写文件时出现了异常.请下以下两段代码 //有问题的代码try { FileOutputStream fos = new FileOutputStream(filePath); byte[] b = new byte[1024];while((in.read