public Level1State read() { try { data = new byte[(int) file.length()]; FileInputStream in = new FileInputStream(file); in.read(data); in.close(); } catch (Exception e) { e.printStackTrace(); } Level1State l1s = Level1State.deserialize(data); return l1s; }
public Save(String fileName) { try { // read something about java.utils.prefs.Preferences file = new File(fileName); if (!file.exists()) { FileOutputStream out = new FileOutputStream(fileName); out.close(); System.out.println("file made"); } } catch (Exception e) { e.printStackTrace(); } }
public void write(byte[] data) throws IOException { this.data = data; System.out.println(data.length); if (file.length() > 1000) { System.out.println("Exists"); // Prompt user to overwrite the save file // Allow user to overwrite save file } else { try { FileOutputStream out = new FileOutputStream(file); out.write(data); out.close(); // IOUtils.write(data, output); } catch (Exception e) { e.printStackTrace(); } } }
public void uploadAttachments(JiraTickets tickets) throws ExecutionException, InterruptedException, IOException { for (JiraTicket t : tickets) { Promise<Issue> issuePromise = issueRestClient.getIssue(t.getId()); Issue i = issuePromise.get(); File rollback = t.getRollback(); File hotfix = t.getHotfix(); if (rollback != null && rollback.canRead()) { issueRestClient.addAttachment( i.getAttachmentsUri(), FileUtils.openInputStream(rollback), rollback.getName()); } if (hotfix != null && hotfix.canRead()) { issueRestClient.addAttachment( i.getAttachmentsUri(), FileUtils.openInputStream(hotfix), hotfix.getName()); } } }