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

📄 ficheirodeobjectos.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 FicheiroDeObjectos implements Serializable
{
	private ObjectInputStream iS;
	private ObjectOutputStream oS;

	public void abreLeitura(String nomeDoFicheiro) {
		try {
			iS = new ObjectInputStream(new FileInputStream(nomeDoFicheiro));
		} catch (Exception e) {
			System.out.println ("N鉶 foi poss韛el abrir o ficheiro para leitura");
		}
	}

	public void abreEscrita(String nomeDoFicheiro) {
		try {
			oS = new ObjectOutputStream(new FileOutputStream(nomeDoFicheiro));
		} catch (Exception e) {
			System.out.println ("N鉶 foi poss韛el abrir o ficheiro para escrita");
		}
	}

	public Object leObjecto() {
		try {
			return iS.readObject();
		} catch (ClassNotFoundException e) {
			System.out.println ("O ficheiro n鉶 cont閙 objectos");
		}
		catch (Exception e1) {
			System.out.println ("N鉶 foi poss韛el ler o ficheiro");
		}
		return iS;
	}

	public void escreveObjecto(Object o) {
		try {
			oS.writeObject(o);
		} catch (Exception e) {
			System.out.println ("N鉶 foi poss韛el abrir escrever no ficheiro");
		}
	}

	public void fechaLeitura() {
		try {
			iS.close();
		} catch (Exception e) {
			System.out.println ("N鉶 foi poss韛el abrir fechar o ficheiro");
		}
	}

	public void fechaEscrita() {
		try {
			oS.close();
		} catch (Exception e) {
			System.out.println ("N鉶 foi poss韛el abrir fechar o ficheiro");
		}
	}
}

⌨️ 快捷键说明

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