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

📄 ficheirodetexto.java

📁 Its a project that i create. The program its like an helpdesk, that allows the user to introduce re
💻 JAVA
字号:
import java.io.*;

public class FicheiroDeTexto {

	// Atributos
	private BufferedReader fR;
	private BufferedWriter fW;

	public void abreLeitura (String nomeDoFicheiro) throws IOException {
		fR = new BufferedReader(new FileReader(nomeDoFicheiro));
	}

	public void abreEscrita (String nomeDoFicheiro) throws IOException {
		fW = new BufferedWriter(new FileWriter(nomeDoFicheiro));
	}

	public String lerLinha () throws IOException {
		return fR.readLine();	
	}

	public int[] lerNumeroInt () throws IOException {
		int[] result = new int[2];
		String st = fR.readLine();
		if (st != null) {
			result[0] = 0;
			result[1] = Integer.parseInt(st);
		} else result[0] = -1;
		return result;
	}

	public void escreverLinha (String linha) throws IOException {
		fW.write(linha,0,linha.length());
		fW.newLine();
	}

	public void escreverNumero (int num) throws IOException {
		String st = "";
		st = st.valueOf(num);
		escreverLinha(st);
	}

	public double [] lerNumeroDouble () throws IOException {
		double [] result = new double [2];
		String st = fR.readLine();
		if (st != null) {
			result[0] = 0;
			result[1] = Double.parseDouble (st);
		} else result[0] = -1;
		return result;
	}

	public void escreverNumero (double num) throws IOException {
		String st = "";
		st = st.valueOf(num);
		escreverLinha(st);
	}

	public void fechaLeitura () throws IOException {
		fR.close();
	}

	public void fechaEscrita () throws IOException {
		fW.close();
	}
}

⌨️ 快捷键说明

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