IO(一)
文件相关
- package com.bjsxt.io.file;
- import java.io.File;
- /**
- * 两个常量
- * 1、路径分隔符 ;
- * 2、名称分隔符 /(windows) /(linux 等)
- *
- *
- * @author Administrator
- *
- */
- public class Demo01 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- System.out.println(File.pathSeparator);
- System.out.println(File.separator);
- //路径表示形式
- String path ="E:\\xp\\test\\2.jpg";
- path="E:"+File.separator+"xp"+File.separator+"test"+File.separator+"2.jpg";
- //推荐方式
- path="E:/xp/test/2.jpg";
- }
- }
- package com.bjsxt.io.file;
- import java.io.File;
- /**
- * 相对路径与绝对路径构造 File对象
- * 1、相对路径
- File(String parent, String child) ==>File("E:/xp/test","2.jpg")
- File(File parent, String child) ==> File(new File("E:/xp/test"),"2.jpg")
- 2、绝对路径
- File(String name);
- * @author Administrator
- *
- */
- public class Demo02 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- String parentPath ="E:/xp/test";
- String name ="2.jpg";
- //相对路径
- File src =new File(parentPath,name);
- src =new File(new File(parentPath),name);
- //输出
- System.out.println(src.getName());
- System.out.println(src.getPath());
- //绝对路径
- src =new File("E:/xp/test/2.jpg");
- System.out.println(src.getName());
- System.out.println(src.getPath());
- //没有盘符: 以 user.dir构建
- src =new File("test.txt");
- src =new File(".");
- System.out.println(src.getName());
- System.out.println(src.getPath());
- System.out.println(src.getAbsolutePath());
- }
- }
- package com.bjsxt.io.file;
- import java.io.File;
- import java.io.IOException;
- import org.junit.Test;
- /**
- * 常用方法:
- 1、文件名
- getName() 文件名、路径名
- getPath()路径名
- getAbsoluteFile() 绝对路径所对应的File对象
- getAbsolutePath() 绝对路径名
- getParent() 父目录 ,相对路径的父目录,可能为null 如. 删除本身后的结果
- 2、判断信息
- exists()
- canWrite()
- canRead()
- isFile()
- isDirectory()
- isAbsolute():消除平台差异,ie以盘符开头,其他以/开头
- 3、长度 字节数 不能读取文件夹的长度
- length()
- 4、创建、删除
- createNewFile() 不存在创建新文件,存在返回false
- delete() 删除文件
- static createTempFile(前缀3个字节长,后缀默认.temp) 默认临时空间
- staticcreateTempFile(前缀3个字节长,后缀默认.temp,目录)
- deleteOnExit() 退出虚拟机删除,常用于删除临时文件
- * @author Administrator
- *
- */
- public class Demo03 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- try {
- test3();
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("文件操作失败");
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- //创建删除文件
- public static void test3() throws IOException, InterruptedException{
- //createNewFile() 不存在创建新文件
- //String path="E:/xp/test/con"; //con系统关键字
- String path="E:/xp/test/200.jpg";
- //String path="E:/xp/test/1.jpg";
- File src =new File(path);
- if(!src.exists()){
- boolean flag =src.createNewFile();
- System.out.println(flag?"成功":"失败");
- }
- //删除文件
- boolean flag =src.delete();
- System.out.println(flag?"成功":"失败");
- //static createTempFile(前缀3个字节长,后缀默认.temp) 默认临时空间
- //static createTempFile(前缀3个字节长,后缀默认.temp,目录)
- File temp= File.createTempFile("tes", ".temp",new File("e:/xp/test"));
- Thread.sleep(10000);
- temp.deleteOnExit(); //退出即删除
- }
- //2、判断信息
- //3、长度 length()
- @Test
- public void test2(){
- //String path ="2.txt";
- String path="E:/xp/test/200.jpg";
- //String path="E:/xp/test/200.jpg";
- File src =new File(path);
- //是否存在
- System.out.println("文件是否存在:"+src.exists());
- //是否可读 写 canWrite() canRead()
- System.out.println("文件是否可写"+src.canWrite());
- System.out.println("============");
- //isFile()
- //isDirectory()
- if(src.isFile()){
- System.out.println("文件");
- }else if(src.isDirectory()){
- System.out.println("文件夹");
- }else{
- System.out.println("文件不存在");
- }
- System.out.println("是否为绝对路径"+src.isAbsolute());
- System.out.println("长度为:"+src.length());
- }
- //1、名称
- @Test
- public void test1(){
- //File src =new File("E:/xp/test/2.jpg");
- //建立联系
- File src =new File("2.txt");
- System.out.println(src.getName()); //返回名称
- System.out.println(src.getPath()); //如果是绝对路径,返回完整路径,否则相对路径
- System.out.println(src.getAbsolutePath());//返回绝对路径
- System.out.println(src.getParent());//返回上一级目录,如果是相对,返回null
- }
- }
- package com.bjsxt.io.file;
- import java.io.File;
- import java.io.FilenameFilter;
- /**
- * 5、操作目录
- mkdir() 创建目录,必须确保 父目录存在,如果不存在,创建失败
- mkdirs() 创建目录,如果父目录链不存在一同创建
- list() 文件|目录 名字符串形式
- listFiles()
- static listRoots() 根路径
- * @author Administrator
- *
- */
- public class Demo04 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- String path ="E:/xp/test/";
- File src =new File(path); //文件夹
- if(src.isDirectory()){ //存在并且为目录
- System.out.println("======子目录|文件名===");
- String[] subNames =src.list();
- for(String temp:subNames){
- System.out.println(temp);
- }
- System.out.println("=====子目录|文件File对象====");
- File[] subFiles =src.listFiles();
- for(File temp:subFiles){
- System.out.println(temp.getAbsolutePath());
- }
- System.out.println("=====子文件.java对象====");
- //命令设计模式
- subFiles =src.listFiles(new FilenameFilter(){
- @Override
- /**
- * dir 代表src
- */
- public boolean accept(File dir, String name) {
- //System.out.println(dir.getAbsolutePath());
- return new File(dir,name).isFile()&&name.endsWith(".java");
- }
- });
- for(File temp:subFiles){
- System.out.println(temp.getAbsolutePath());
- }
- }
- }
- public static void test1(){
- String path ="E:/xp/test/parent/p/test";
- File src =new File(path);
- //src.mkdir();
- src.mkdirs();
- }
- }
- package com.bjsxt.io.file;
- import java.io.File;
- import java.io.FilenameFilter;
- /**
- * 5、操作目录
- mkdir() 创建目录,必须确保 父目录存在,如果不存在,创建失败
- mkdirs() 创建目录,如果父目录链不存在一同创建
- list() 文件|目录 名字符串形式
- listFiles()
- static listRoots() 根路径
- * @author Administrator
- *
- */
- public class Demo04 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- String path ="E:/xp/test/";
- File src =new File(path); //文件夹
- if(src.isDirectory()){ //存在并且为目录
- System.out.println("======子目录|文件名===");
- String[] subNames =src.list();
- for(String temp:subNames){
- System.out.println(temp);
- }
- System.out.println("=====子目录|文件File对象====");
- File[] subFiles =src.listFiles();
- for(File temp:subFiles){
- System.out.println(temp.getAbsolutePath());
- }
- System.out.println("=====子文件.java对象====");
- //命令设计模式
- subFiles =src.listFiles(new FilenameFilter(){
- @Override
- /**
- * dir 代表src
- */
- public boolean accept(File dir, String name) {
- //System.out.println(dir.getAbsolutePath());
- return new File(dir,name).isFile()&&name.endsWith(".java");
- }
- });
- for(File temp:subFiles){
- System.out.println(temp.getAbsolutePath());
- }
- }
- }
- public static void test1(){
- String path ="E:/xp/test/parent/p/test";
- File src =new File(path);
- //src.mkdir();
- src.mkdirs();
- }
- }
- package com.bjsxt.io.file;
- import java.io.File;
- import java.util.Arrays;
- /**
- * 输出子孙级目录|文件的名称(绝对路径)
- * 1、listFiles()
- * 2、递归
- *
- * static listRoots() 根路径
- * @author Administrator
- *
- */
- public class Demo05 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- String path ="E:/xp/test";
- File parent =new File(path);
- //printName(parent);
- File[] roots =File.listRoots();
- System.out.println(Arrays.toString(roots));
- for(File temp:roots){
- //printName(temp);
- }
- }
- /**
- * 输出路径
- */
- public static void printName(File src){
- if(null==src || !src.exists()){
- return ;
- }
- System.out.println(src.getAbsolutePath());
- if(src.isDirectory()){ //文件夹
- for(File sub:src.listFiles()){
- printName(sub);
- }
- }
- }
- }
IO流:
- package com.bjsxt.io.byteIO;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.io.InputStream;
- /**
- * 文件的读取
- * 1、建立联系 File对象
- 2、选择流 文件输入流 InputStream FileInputStream
- 3、操作 : byte[] car =new byte[1024]; +read+读取大小
- 输出
- 4、释放资源 :关闭
- * @author Administrator
- *
- */
- public class Demo01 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- //1、建立联系 File对象
- File src =new File("e:/xp/test/a.txt");
- //2、选择流
- InputStream is =null; //提升作用域
- try {
- is =new FileInputStream(src);
- //3、操作 不断读取 缓冲数组
- byte[] car =new byte[1024];
- int len =0; //接收 实际读取大小
- //循环读取
- StringBuilder sb =new StringBuilder();
- while(-1!=(len=is.read(car))){
- //输出 字节数组转成字符串
- String info =new String(car,0,len);
- sb.append(info);
- }
- System.out.println(sb.toString());
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- System.out.println("文件不存在");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("读取文件失败");
- }finally{
- try {
- //4、释放资源
- if (null != is) {
- is.close();
- }
- } catch (Exception e2) {
- System.out.println("关闭文件输入流失败");
- }
- }
- }
- }
- package com.bjsxt.io.byteIO;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.OutputStream;
- /**
- * 写出文件
- 1、建立联系 File对象 目的地
- 2、选择流 文件输出流 OutputStream FileOutputStream
- 3、操作 : write() +flush
- 4、释放资源 :关闭
- * @author Administrator
- *
- */
- public class Demo02 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- //1、建立联系 File对象 目的地
- File dest =new File("e:/xp/test/test.txt");
- //2、选择流 文件输出流 OutputStream FileOutputStream
- OutputStream os =null;
- //以追加形式 写出文件 必须为true 否则为覆盖
- try {
- os =new FileOutputStream(dest,true);
- //3、操作
- String str="bjsxt is very good \r\n";
- //字符串转字节数组
- byte[] data =str.getBytes();
- os.write(data,0,data.length);
- os.flush(); //强制刷新出去
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- System.out.println("文件未找到");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("文件写出失败");
- }finally{
- //4、释放资源 :关闭
- try {
- if (null != os) {
- os.close();
- }
- } catch (Exception e2) {
- System.out.println("关闭输出流失败");
- }
- }
- }
- }
- package com.bjsxt.io.byteIO;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- /**
- 1、建立联系 File对象 源头 目的地
- 2、选择流
- 文件输入流 InputStream FileInputStream
- 文件输出流 OutputStream FileOutputStream
- 3、操作 : 拷贝
- byte[] flush =new byte[1024];
- int len =0;
- while(-1!=(len=输入流.read(flush))){
- 输出流.write(flush,0,len)
- }
- 输出流.flush
- 4、释放资源 :关闭 两个流
- * @author Administrator
- *
- */
- public class CopyFileDemo {
- /**
- * @param args
- * @throws FileNotFoundException
- */
- public static void main(String[] args) {
- String src ="E:/xp/test";
- String dest="e:/xp/test/4.jpg";
- try {
- copyFile(src,dest);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- System.out.println("文件不存在");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("拷贝文件失败|关闭流失败");
- }
- }
- /**
- * 文件的拷贝
- * @param 源文件路径
- * @param 目录文件路径
- * @throws FileNotFoundException,IOException
- * @return
- */
- public static void copyFile(String srcPath,String destPath) throws FileNotFoundException,IOException {
- //1、建立联系 源(存在且为文件) +目的地(文件可以不存在)
- File src =new File(srcPath);
- File dest =new File(destPath);
- if(! src.isFile()){ //不是文件或者为null
- System.out.println("只能拷贝文件");
- throw new IOException("只能拷贝文件");
- }
- //2、选择流
- InputStream is =new FileInputStream(src);
- OutputStream os =new FileOutputStream(dest);
- //3、文件拷贝 循环+读取+写出
- byte[] flush =new byte[1024];
- int len =0;
- //读取
- while(-1!=(len=is.read(flush))){
- //写出
- os.write(flush, 0, len);
- }
- os.flush(); //强制刷出
- //关闭流
- os.close();
- is.close();
- }
- }
- package com.bjsxt.io.byteIO;
- import java.io.BufferedInputStream;
- import java.io.BufferedOutputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- /**
- * 文件操作
- * 1、文件拷贝
- * 2、文件夹拷贝 拒绝自己拷贝给自己
- * @author Administrator
- *
- */
- public class FileUtil {
- /**
- * 拷贝文件夹
- * @param src 源路径
- * @param dest 目标路径
- * @throws IOException
- * @throws FileNotFoundException
- */
- public static void copyDir(String srcPath,String destPath) throws FileNotFoundException, IOException{
- //拒绝自己拷贝给自己
- if(srcPath.equals(destPath)){
- return ;
- }
- File src=new File(srcPath);
- File dest =new File(destPath);
- copyDir(src,dest);
- }
- /**
- * 拷贝文件夹
- * @param src 源File对象
- * @param dest 目标File对象
- * @throws IOException
- * @throws FileNotFoundException
- */
- public static void copyDir(File src,File dest) throws FileNotFoundException, IOException{
- if(src.isDirectory()){ //文件夹
- dest =new File(dest,src.getName());
- if(dest.getAbsolutePath().contains(src.getAbsolutePath())){
- System.out.println("父目录不能拷贝到子目录中");
- return;
- }
- }
- copyDirDetail(src,dest);
- }
- /**
- * 拷贝文件夹细节
- * @param src
- * @param dest
- */
- public static void copyDirDetail(File src,File dest) throws FileNotFoundException,IOException{
- if(src.isFile()){ //文件
- try {
- FileUtil.copyFile(src, dest);
- } catch (FileNotFoundException e) {
- //e.printStackTrace();
- throw e;
- } catch (IOException e) {
- //e.printStackTrace();
- throw e;
- }
- }else if(src.isDirectory()){ //文件夹
- //确保目标文件夹存在
- dest.mkdirs();
- //获取下一级目录|文件
- for(File sub:src.listFiles()){
- copyDirDetail(sub,new File(dest,sub.getName()));
- }
- }
- }
- /**
- * 文件的拷贝
- * @param 源文件路径
- * @param 目录文件路径
- * @throws FileNotFoundException,IOException
- * @return
- */
- public static void copyFile(String srcPath,String destPath) throws FileNotFoundException,IOException {
- //1、建立联系 源(存在且为文件) +目的地(文件可以不存在)
- copyFile(new File(srcPath),new File(destPath));
- }
- /**
- * 文件的拷贝
- * @param 源文件File对象
- * @param 目录文件File对象
- * @throws FileNotFoundException,IOException
- * @return
- */
- public static void copyFile(File src,File dest) throws FileNotFoundException,IOException {
- if(! src.isFile()){ //不是文件或者为null
- System.out.println("只能拷贝文件");
- throw new IOException("只能拷贝文件");
- }
- //dest为已经存在的文件夹,不能建立于文件夹同名的文件
- if(dest.isDirectory()){
- System.out.println(dest.getAbsolutePath()+"不能建立于文件夹同名的文件");
- throw new IOException(dest.getAbsolutePath()+"不能建立于文件夹同名的文件");
- }
- //2、选择流
- InputStream is =new BufferedInputStream(new FileInputStream(src));
- OutputStream os =new BufferedOutputStream(new FileOutputStream(dest));
- //3、文件拷贝 循环+读取+写出
- byte[] flush =new byte[1024];
- int len =0;
- //读取
- while(-1!=(len=is.read(flush))){
- //写出
- os.write(flush, 0, len);
- }
- os.flush(); //强制刷出
- //关闭流
- os.close();
- is.close();
- }
- }
- package com.bjsxt.io.byteIO;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- /**
- * 文件夹的拷贝
- * 1、文件 赋值 copyFile
- * 2、文件 创建 mkdirs()
- * 3、递归查找子孙级
- *
- * @author Administrator
- *
- */
- public class CopyDir {
- /**
- * @param args
- */
- public static void main(String[] args) {
- //源目录
- String srcPath="E:/xp/test/a";
- //目标目录
- String destPath="E:/xp/test/a/b";
- try {
- FileUtil.copyDir(srcPath,destPath);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- /**
- * 拷贝文件夹
- * @param src 源路径
- * @param dest 目标路径
- */
- public static void copyDir(String srcPath,String destPath){
- File src=new File(srcPath);
- File dest =new File(destPath);
- copyDir(src,dest);
- }
- /**
- * 拷贝文件夹
- * @param src 源File对象
- * @param dest 目标File对象
- */
- public static void copyDir(File src,File dest){
- if(src.isDirectory()){ //文件夹
- dest =new File(dest,src.getName());
- }
- copyDirDetail(src,dest);
- }
- /**
- * 拷贝文件夹细节
- * @param src
- * @param dest
- */
- public static void copyDirDetail(File src,File dest){
- if(src.isFile()){ //文件
- try {
- FileUtil.copyFile(src, dest);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }else if(src.isDirectory()){ //文件夹
- //确保目标文件夹存在
- dest.mkdirs();
- //获取下一级目录|文件
- for(File sub:src.listFiles()){
- copyDirDetail(sub,new File(dest,sub.getName()));
- }
- }
- }
- }
- package com.bjsxt.io.charIO;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.IOException;
- import java.io.Reader;
- /**
- * 纯文本读取
- * @author Administrator
- *
- */
- public class Demo01 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- //创建源
- File src =new File("E:/xp/test/a.txt");
- //选择流
- Reader reader =null;
- try {
- reader =new FileReader(src);
- //读取操作
- char[] flush =new char[1024];
- int len =0;
- while(-1!=(len=reader.read(flush))){
- //字符数组转成 字符串
- String str =new String(flush,0,len);
- System.out.println(str);
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- System.out.println("源文件不存在");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("文件读取失败");
- }finally{
- try {
- if (null != reader) {
- reader.close();
- }
- } catch (Exception e2) {
- }
- }
- }
- }
- package com.bjsxt.io.charIO;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.Writer;
- /**
- * 写出文件
- * @author Administrator
- *
- */
- public class Demo02 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- //创建源
- File dest =new File("e:/xp/test/char.txt");
- //选择流
- Writer wr =null;
- try {
- //追加文件,而不是覆盖文件
- wr =new FileWriter(dest);
- //写出
- String msg ="追加.....锄禾日当午\r\n码农真辛苦\r\n一本小破书\r\n一读一上午";
- wr.write(msg);
- wr.append("倒萨发了看电视剧 ");
- wr.flush();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }catch (IOException e) {
- e.printStackTrace();
- }finally{
- try {
- if (null != wr) {
- wr.close();
- }
- } catch (Exception e2) {
- }
- }
- }
- }
- package com.bjsxt.io.charIO;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.Reader;
- import java.io.Writer;
- /**
- * 纯文本拷贝
- * @author Administrator
- *
- */
- public class CopyFileDemo {
- /**
- * @param args
- */
- public static void main(String[] args) {
- //创建源 仅限于 字符的纯文本
- File src =new File("E:/xp/test/Demo03.java");
- File dest =new File("e:/xp/test/char.txt");
- //选择流
- Reader reader =null;
- Writer wr =null;
- try {
- reader =new FileReader(src);
- wr =new FileWriter(dest);
- //读取操作
- char[] flush =new char[1024];
- int len =0;
- while(-1!=(len=reader.read(flush))){
- wr.write(flush, 0, len);
- }
- wr.flush();//强制刷出
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- System.out.println("源文件不存在");
- } catch (IOException e) {
- e.printStackTrace();
- System.out.println("文件读取失败");
- }finally{
- try {
- if (null != wr) {
- wr.close();
- }
- } catch (Exception e2) {
- }
- try {
- if (null != reader) {
- reader.close();
- }
- } catch (Exception e2) {
- }
- }
- }
- }
IO(一)的更多相关文章
- VS2015编译GEOS
下载链接:http://trac.osgeo.org/geos/ 1. 打开cmake,加载geos源码和定位geos的工程存放位置: 2.点击configure,会报错,首先设置CMAKE_INST ...
- 高性能IO模型浅析
高性能IO模型浅析 服务器端编程经常需要构造高性能的IO模型,常见的IO模型有四种: (1)同步阻塞IO(Blocking IO):即传统的IO模型. (2)同步非阻塞IO(Non-blocking ...
- 深究标准IO的缓存
前言 在最近看了APUE的标准IO部分之后感觉对标准IO的缓存太模糊,没有搞明白,APUE中关于缓存的部分一笔带过,没有深究缓存的实现原理,这样一本被吹上天的书为什么不讲透彻呢?今天早上爬起来赶紧找了 ...
- [APUE]标准IO库(下)
一.标准IO的效率 对比以下四个程序的用户CPU.系统CPU与时钟时间对比 程序1:系统IO 程序2:标准IO getc版本 程序3:标准IO fgets版本 结果: [注:该表截取自APUE,上表中 ...
- [APUE]标准IO库(上)
一.流和FILE对象 系统IO都是针对文件描述符,当打开一个文件时,即返回一个文件描述符,然后用该文件描述符来进行下面的操作,而对于标准IO库,它们的操作则是围绕流(stream)进行的. 当打开一个 ...
- [.NET] 利用 async & await 进行异步 IO 操作
利用 async & await 进行异步 IO 操作 [博主]反骨仔 [出处]http://www.cnblogs.com/liqingwen/p/6082673.html 序 上次,博主 ...
- [原] KVM 虚拟化原理探究(6)— 块设备IO虚拟化
KVM 虚拟化原理探究(6)- 块设备IO虚拟化 标签(空格分隔): KVM [toc] 块设备IO虚拟化简介 上一篇文章讲到了网络IO虚拟化,作为另外一个重要的虚拟化资源,块设备IO的虚拟化也是同样 ...
- [原] KVM 虚拟化原理探究(5)— 网络IO虚拟化
KVM 虚拟化原理探究(5)- 网络IO虚拟化 标签(空格分隔): KVM IO 虚拟化简介 前面的文章介绍了KVM的启动过程,CPU虚拟化,内存虚拟化原理.作为一个完整的风诺依曼计算机系统,必然有输 ...
- Performance Monitor4:监控SQL Server的IO性能
SQL Server的IO性能受到物理Disk的IO延迟和SQL Server内部执行的IO操作的影响.在监控Disk性能时,最主要的度量值(metric)是IO延迟,IO延迟是指从Applicati ...
- java.IO输入输出流:过滤流:buffer流和data流
java.io使用了适配器模式装饰模式等设计模式来解决字符流的套接和输入输出问题. 字节流只能一次处理一个字节,为了更方便的操作数据,便加入了套接流. 问题引入:缓冲流为什么比普通的文件字节流效率高? ...
随机推荐
- 【BZOJ】【2705】【SDOI2012】Longge的问题
欧拉函数/狄利克雷卷积/积性函数 2705: [SDOI2012]Longge的问题 Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 1275 Solv ...
- Centos编译安装PHP 5.5笔记
本篇是在 Centos 6.4 32bit 下编译安装 php 5.5.5 的笔记,接上篇 Centos编译安装Apache 2.4.6笔记.php 5.5.x 和 centos 源里面的 php 5 ...
- Nodejs Express 4.X 中文API 4--- Router篇
相关阅读: Express 4.X API 翻译[一] -- Application篇 Express4.XApi 翻译[二] -- Request篇 Express4.XApi 翻译[三] -- ...
- iOS 面试题
1.Object-c的类可以多重继承么?可以实现多个接口么?Category是什么?重写一个类的方式用继承好还是分类好?为什么? 答:不可以,可以实现多个接口:category是分类,,一般情况下分类 ...
- Redis与Memcached的incr/decr差异对比
目前广泛使用的分布式缓存Redis和Memcached均支持对整数型Value值的增减,对应到具体命令中就是incr和decr命令. incr/decr是原子性操作(memcached 1.2.4及以 ...
- SSH开发实践part2:双向1-N连接配置
1 OK,上一篇已经介绍了项目开发的前期准备工作,具体内容可以参考:http://www.cnblogs.com/souvenir/p/3783686.html 按照开发步骤,我们现在已经可以开始进行 ...
- lintcode: 堆化
堆化 给出一个整数数组,堆化操作就是把它变成一个最小堆数组. 对于堆数组A,A[0]是堆的根,并对于每个A[i],A [i * 2 + 1]是A[i]的左儿子并且A[i * 2 + 2]是A[i]的右 ...
- Android核心分析之二十一Android应用框架之AndroidApplication
Android Application Android提供给开发程序员的概念空间中Application只是一个松散的表征概念,没有多少实质上的表征.在Android实际空间中看不到实际意义上的应用程 ...
- Java-J2SE学习笔记-字符串转化为二维数组
1.字符串转化为二维Double数组 2.代码: package Test; public class TestDouble { public static void main(String[] ar ...
- SWD接口:探索&泄密&延伸
http://bbs.21ic.com/icview-871133-1-1.html 文买了个JLINKV9,以为神器,拿到手发现根本不是,完全没必要替换V8,想自己做个另类的调试器,当然想只是想而已 ...