Here you can find the source of saveBytesAsIfile(final IFile file, final byte[] bytes)
Parameter | Description |
---|---|
file | The ifile object to write to |
bytes | The contents to write |
Parameter | Description |
---|---|
CoreException | A |
public static void saveBytesAsIfile(final IFile file, final byte[] bytes) throws CoreException
//package com.java2s; import java.io.ByteArrayInputStream; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; public class Main { /**//w w w . j a va 2 s . com * Helper to write an ifile to the workspace from a string. * * @param file The ifile object to write to * @param bytes The contents to write * @throws CoreException A */ public static void saveBytesAsIfile(final IFile file, final byte[] bytes) throws CoreException { file.setContents(new ByteArrayInputStream(bytes), /* force if not in sync */ true, /* keep history */ false, /* progress monitor */ null); } }