This is my first write blog in english,maybe it has some errors,so,I hope reader can point the problem,I will modified it.
Now,I will talk about the IO in java。You know IO is the important aspect,not only in java,but also in every computer language。We will use IO to read something or write something from files.
In java,IO can divide into two aspect,one is input stream and output stream。Another is character stream and byte stream。They are not different,just in two statement。
And in java api,we can use many class to help us to complete many operation on files.It is very easy to use this class,you can refer to the api。But we must pay attention to one thing。Buffer stream is different from the other,because when you use BufferedOutputStream to write information in file,it first reserved this in buffer,so if the program is terminated,the information will lost。we can use flush() to solve this problem。Do not forget use close() to close this stream,we need economize memory.
package cn.czm0910; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class FileDemo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try { fileReadWrite("a.txt","b.txt"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 文件读取 * @param path * @throws IOException */ public static void fileReadWrite(String path1,String path2) throws IOException{ FileInputStream fis = new FileInputStream(path1); FileOutputStream fos = new FileOutputStream(path2); BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream bos = new BufferedOutputStream(fos); //byte[] buf=new byte[1024]; int i=0; System.out.println(fis.available()); while((i=bis.read())!=-1){ bos.write(i); bos.flush(); } fis.close(); fos.close(); } }
相关推荐
English | 28 Apr. 2017 | ASIN: B01N6VAO4P | 454 Pages | AZW3 | 7.38 MB Key Features Understand and use Vue's reactivity system, data binding, and computed properties Create fluid transitions in your...
using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Collections; using System.Collections.Specialized; namespace wuyisky { public class IniFiles { public string ...
using System.IO; class Program { static void Main() { FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = Directory.GetCurrentDirectory(); watcher.Filter = "*.txt"; watcher....
using System.IO; ``` 然后,在Form1类中,定义CultureInfo对象(ci)和ResourceManager对象(rm),用于处理语言切换和获取资源: ```csharp private CultureInfo ci; private ResourceManager rm; ``` 当用户选择...
using System.IO; using Microsoft.Office.Interop.Modi; public class OcrExample { public void RecognizeText(string imagePath) { // 创建MODI文档对象 MDIApplication mdi = new MDIApplication(); mdi....
English | 6 Jun. 2017 | ASIN: B072MKRQBQ | 236 Pages | AZW3 | 2.78 MB Data Science is booming thanks to R and Python, but Java brings the robustness, convenience, and ability to scale critical to ...
English | 6 Jun. 2017 | ASIN: B01IF7NLDW | 340 Pages | AZW3 | 2.55 MB Key Features Gain a complete understanding of data structures using a simple approach Analyze algorithms and learn when you ...
using System.IO; using Microsoft.Office.Interop.MODI; namespace C_Ocr_lib { public class OcrEngine { public string ExtractTextFromImage(string imagePath) { try { MODI.Document doc = new MODI....
using System.IO; using Microsoft.Office.Interop.MODI; public class MODIHelper { public static string ImageToText(string imagePath) { try { // 初始化MODI环境 MODI.Document doc = new MODI....
Single Page Web Applications shows how your team can easily design, test, maintain, and extend sophisticated SPAs using JavaScript end-to-end, without getting locked into a framework. Along the way, ...
English | 20 Mar. 2017 | ASIN: B06X9N272Y | 118 Pages | AZW3 | 2.44 MB Key Features Written by the creator of the Angular router, giving you the best information straight from the source Get full ...
6. **http://seg.iit.nrc.ca/English/index.html**:位于加拿大的软件工程质量研究组织,提供了一系列研究论文的下载服务,适合于那些希望深入了解软件质量管理和控制的专业人士。 7. **http://sepo.nosc.mil/**:...
https: //help.clubhouse.io/hc/zh-CN/articles/207540323-Using-the-Clubhouse-GitHub-Integration-with-Branches-and-Pull-Requests这是JIRAfy的修改后的分叉:https:// github com / square / jirafy 支持语言...
using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Collections; using System.Collections.Specialized; public class IniFiles { public string FileName; [DllImport...
using System.IO; using System.Xml; // 加载XML文件 string xmlPath = "LanguageResources.xml"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); // 创建一个字典存储每种语言的资源 Dictionary...
- English Document:[en.md](/blob/master/en.md) ## 轻量版 为了满足开发者对于简单、轻量级 API 框架的需求,开发了 gin-api-mono,旨在提供更便捷的业务开发体验。 相比于 go-gin-api,首先 gin-api-mono ...
JOHN THOMAS ENGLISH A THESIS Presented to the Department of Geography and the Graduate School of the University of Oregon in partial fulfillment of the requirements for the degree of Master of Science...
using System.IO; using Microsoft.Office.Interop.MODI; public class OcrProcessor { public string ProcessImage(string imagePath) { // 初始化MODI环境 MODI.Document doc = new MODI.Document(); try {...
Chapter 7: Async IO – Multithreading without Threads Chapter 8: Metaclasses – Making Classes (Not Instances) Smarter Chapter 9: Documentation – How to Use Sphinx and reStructuredText Chapter 10: ...