Here you can find the source of appendToFile(IFile file, String output)
public static boolean appendToFile(IFile file, String output)
//package com.java2s; /******************************************************************************* * Copyright (c) 2016 University of York. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * //w ww . ja v a2s . co m * Contributors: * Simos Gerasimou - initial API and implementation ******************************************************************************/ import java.io.ByteArrayInputStream; import java.io.InputStream; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; public class Main { public static boolean appendToFile(IFile file, String output) { try { if (!file.exists()) return false; InputStream source = new ByteArrayInputStream(output.getBytes()); file.appendContents(source, IFile.FORCE, null); return true; } catch (CoreException e) { e.printStackTrace(); } return true; } }