Code example for File

Methods: canWrite

0
	@Override 
	protected void setUp() throws Exception { 
		OutputStream outputStream = null;
		try { 
			testFile = File.createTempFile("testCopyFiles", ".txt");
			if (testFile.canWrite()) {
				outputStream = new FileOutputStream(testFile);
				outputStream.write(testFileContent.getBytes());
				outputStream.flush();
			} 
		} catch (IOException e) {
			e.printStackTrace();
		} finally { 
			if (outputStream != null) {
				outputStream.close();
			} 
		} 
 
		super.setUp(); 
	}