1 19 20 package org.netbeans.modules.j2ee.ejbcore.test; 21 22 import java.io.ByteArrayInputStream ; 23 import java.io.IOException ; 24 import java.io.InputStream ; 25 import java.io.OutputStream ; 26 import org.openide.filesystems.FileObject; 27 import org.openide.filesystems.FileUtil; 28 29 35 public class TestUtilities { 36 37 private TestUtilities() { 38 } 39 40 public static final FileObject copyStringToFileObject(FileObject fo, String content) throws IOException { 41 OutputStream os = fo.getOutputStream(); 42 try { 43 InputStream is = new ByteArrayInputStream (content.getBytes("UTF-8")); 44 FileUtil.copy(is, os); 45 return fo; 46 } finally { 47 os.close(); 48 } 49 } 50 } 51 | Popular Tags |