public static OutputStream create(Path f, boolean append) throws IOException { if (!nativeLoaded) { throw new IOException("Native WSCE libraries are required for create"); } long desiredAccess = Windows.GENERIC_WRITE; long shareMode = 0L; long creationDisposition = append ? Windows.OPEN_ALWAYS : Windows.CREATE_ALWAYS; long flags = Windows.FILE_ATTRIBUTE_NORMAL; String fileName = f.toString(); fileName = fileName.replace('/', '\\'); long hFile = elevatedCreateImpl( fileName, desiredAccess, shareMode, creationDisposition, flags); return new FileOutputStream( WinutilsProcessStub.getFileDescriptorFromHandle(hFile)); }