⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readfile.java

📁 根据设定时间自动备份数据库。用java编写的
💻 JAVA
字号:
package com.oracle;
import java.io.*;
public class ReadFile{
	public int hour;
	public int min;
	public String databaseName;
	public String userName;
	public String password;
	public String backPath;
	public String ownerUsers;
	public String winRarPath;
	private String[] dataTxt=new String[7];
	
	public ReadFile(int h,int m){
		this.hour=h;
		this.min=m;
		readTextTime();
		initOthers();
	}
	public void readTextTime(){  
	 String str=null;
         try{
         	 BufferedReader br=new BufferedReader(new InputStreamReader(new   FileInputStream(".\\DataIn.txt")));   
         	 for(int i=0;i<7;i++){
         	 	str= br.readLine();
	         	str=str.substring(str.indexOf("=")+1);
	         	if(i!=5&&i!=6){//path 不需要替换空格
	         		str=str.replaceAll(" ","");
	         	}
	         	dataTxt[i]=str;
	         	//System.out.println(i);
         	 }
             br.close();
         }catch(Exception ex){
         	System.out.println("===============read error==================");
         	ex.printStackTrace();
         }
         str=dataTxt[0];
         String[] strArray=str.split(":");
         if(strArray.length!=2){
         	strArray=str.split(":");
         	
         	if(strArray.length!=2){
         	System.out.println("时间格式不正确,系统将采用默认时间");
         	return;
         	}
         }
         this.hour=Integer.parseInt(strArray[0]);
         this.min=Integer.parseInt(strArray[1]);
         
      };   
      
    private void initOthers(){
    	
         String str=null;
	     this.databaseName=this.dataTxt[1];
         this.userName=this.dataTxt[2];
         this.password=this.dataTxt[3];
         this.ownerUsers=this.dataTxt[4]; 
         str= this.dataTxt[5]; 
	         /*
	          *delete last code '/'or'\'
	          */
	     char  ch='a';
	     ch=str.charAt(str.length()-1);
	     while(ch=='/'||ch=='\\'){
	        str=str.substring(0,str.length()-1);
	        ch=str.charAt(str.length()-1);
	     }
	     this.backPath=str;
    	this.winRarPath=this.dataTxt[6];
    }
    
/*	public static void main(String[] args){
		ReadFile rf=new ReadFile(1,25);
		Tools t=new Tools();
		t.printBat("20081216",rf.databaseName,rf.userName,rf.password,rf.backPath,rf.ownerUsers,rf.winRarPath);
		t.runBat("14:14");
	}*/
}

⌨️ 快捷键说明

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