当前位置: 首页>>代码示例>>Java>>正文


Java FileObserver.ACCESS属性代码示例

本文整理汇总了Java中android.os.FileObserver.ACCESS属性的典型用法代码示例。如果您正苦于以下问题:Java FileObserver.ACCESS属性的具体用法?Java FileObserver.ACCESS怎么用?Java FileObserver.ACCESS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.os.FileObserver的用法示例。


在下文中一共展示了FileObserver.ACCESS属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onEvent

@Override
public void onEvent(int event, String path) {
	if (DebugLog.DEBUG) Log.d(TAG, "FileAccessService.AccessObserver.onEvent - access triggered");
	switch (event) {
		case FileObserver.ACCESS:
			values[READS] = Long.valueOf(values[READS].longValue() + 1);
			break;
		case FileObserver.MODIFY:
			values[WRITES] = Long.valueOf(values[WRITES].longValue() + 1);
			break;
		case FileObserver.CREATE:
			values[CREATES] = Long.valueOf(values[CREATES].longValue() + 1);
			break;
		case FileObserver.DELETE:
			values[DELETES] = Long.valueOf(values[DELETES].longValue() + 1);
			break;
		default:
			return;
	}
	updateMetric = new UpdateMetric();	// is this needed (nothing static)?
	metricHandler.post(updateMetric);
}
 
开发者ID:Sean1988,项目名称:CIMON_Android,代码行数:22,代码来源:FileAccessService.java

示例2: performUpdates

@Override
protected void performUpdates() {
	long nextUpdate = updateValueNodes();
	if (nextUpdate < 0) {
		if (accessObserver != null) {
			accessObserver.stopWatching();
			accessObserver = null;
		}
	}
	else {
		if (accessObserver == null) {
			accessObserver = new AccessObserver(Environment.getExternalStorageDirectory().getPath(), 
					FileObserver.ACCESS | FileObserver.MODIFY | FileObserver.CREATE | FileObserver.DELETE);
			accessObserver.startWatching();
		}
	}
	updateObservable();
}
 
开发者ID:Sean1988,项目名称:CIMON_Android,代码行数:18,代码来源:FileAccessService.java

示例3: toString

public static String toString(final int event) {
    switch (event) {
        case FileObserver.ACCESS:
            return "ACCESS";
        case FileObserver.MODIFY:
            return "MODIFY";
        case FileObserver.ATTRIB:
            return "ATTRIB";
        case FileObserver.CLOSE_WRITE:
            return "CLOSE_WRITE";
        case FileObserver.CLOSE_NOWRITE:
            return "CLOSE_NOWRITE";
        case FileObserver.OPEN:
            return "OPEN";
        case FileObserver.MOVED_FROM:
            return "MOVED_FROM";
        case FileObserver.MOVED_TO:
            return "MOVED_TO";
        case FileObserver.CREATE:
            return "CREATE";
        case FileObserver.DELETE:
            return "DELETE";
        case FileObserver.DELETE_SELF:
            return "DELETE_SELF";
        case FileObserver.MOVE_SELF:
            return "MOVE_SELF";
        default:
            return "0x" + Integer.toHexString(event);
    }
}
 
开发者ID:Git-tl,项目名称:appcan-plugin-pdfreader-android,代码行数:30,代码来源:FileSystemScanner.java

示例4: onEvent

@Override
public void onEvent(final int event, final String path) {
    Intent localIntent = new Intent(INTENT_EBOOK_MODIFIED);
    localIntent.putExtra(INTENT_EBOOK_MODIFIED_PATH, path);
    switch (event) {
        case FileObserver.ACCESS:
            BookLibApplication.d(LOG_TAG + "onEvent() ACCESS: " + path);
            break;
        case FileObserver.ATTRIB:
            BookLibApplication.d(LOG_TAG + "onEvent() ATTRIB: " + path);
            break;
        case FileObserver.CLOSE_NOWRITE:
            BookLibApplication.d(LOG_TAG + "onEvent() CLOSE_NOWRITE: " + path);
            break;
        case FileObserver.CLOSE_WRITE:
            BookLibApplication.d(LOG_TAG + "onEvent() CLOSE_WRITE: " + path);
            break;
        case FileObserver.CREATE:
            BookLibApplication.d(LOG_TAG + "onEvent() CREATE: " + path);
            BookLibApplication.getInstance().sendBroadcast(localIntent);
            break;
        case FileObserver.DELETE:
            BookLibApplication.d(LOG_TAG + "onEvent() DELETE: " + path);
            BookLibApplication.getInstance().sendBroadcast(localIntent);
            break;
        case FileObserver.DELETE_SELF:
            BookLibApplication.d(LOG_TAG + "onEvent() DELETE_SELF: " + path);
            BookLibApplication.getInstance().sendBroadcast(localIntent);
            break;
        case FileObserver.MODIFY:
            BookLibApplication.d(LOG_TAG + "onEvent() MODIFY: " + path);
            BookLibApplication.getInstance().sendBroadcast(localIntent);
            break;
        case FileObserver.MOVE_SELF:
            BookLibApplication.d(LOG_TAG + "onEvent() MOVE_SELF: " + path);
            BookLibApplication.getInstance().sendBroadcast(localIntent);
            break;
        case FileObserver.MOVED_FROM:
            BookLibApplication.d(LOG_TAG + "onEvent() MOVED_FROM: " + path);
            BookLibApplication.getInstance().sendBroadcast(localIntent);
            break;
        case FileObserver.MOVED_TO:
            BookLibApplication.d(LOG_TAG + "onEvent() MOVED_TO: " + path);
            BookLibApplication.getInstance().sendBroadcast(localIntent);
            break;
        case FileObserver.OPEN:
            BookLibApplication.d(LOG_TAG + "onEvent() OPEN: " + path);
            break;
        default:
            //BookLibApplication.d(LOG_TAG + "onEvent() DEFAULT(" + event + "): " + path);
            break;
    }
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:53,代码来源:RecursiveFileObserver.java

示例5: onEvent

@Override
public void onEvent(int event, String path) {
    switch (event) {
        case FileObserver.ACCESS:
            Log.i(TAG, "ACCESS");
            break;
        case FileObserver.ATTRIB:
            Log.i(TAG, "ATTRIB");
            break;
        case FileObserver.CLOSE_NOWRITE:
            Log.i(TAG, "CLOSE_NOWRITE");
            break;
        case FileObserver.CLOSE_WRITE:
            Log.i(TAG, "CLOSE_WRITE");
            break;
        case FileObserver.CREATE:
            Log.i(TAG, "CREATE");
            break;
        case FileObserver.DELETE:
            Log.i(TAG, "DELETE");
            break;
        case FileObserver.DELETE_SELF:
            Log.i(TAG, "DELETE_SELF");
            break;
        case FileObserver.MODIFY:
            Log.i(TAG, "MODIFY");
            break;
        case FileObserver.MOVE_SELF:
            Log.i(TAG, "MOVE_SELF");
            break;
        case FileObserver.MOVED_FROM:
            Log.i(TAG, "MOVED_FROM");
            break;
        case FileObserver.MOVED_TO:
            Log.i(TAG, "MOVED_TO");
            break;
        case FileObserver.OPEN:
            Log.i(TAG, "OPEN");
            break;
        case FileObserver.ALL_EVENTS:
            Log.i(TAG, "ALL_EVENTS");
            break;
        default:
            Log.i(TAG, "default, event=" + event + ", path=" + path);
            break;
    }

}
 
开发者ID:cheyiliu,项目名称:test4android,代码行数:48,代码来源:MainActivity.java

示例6: onEvent

@Override
public void onEvent(int event, String path) {
    String parse = null;

    switch(event) {
        case FileObserver.CREATE:
            parse = "file created";
            break;
        case FileObserver.MODIFY:
            parse = "file modified";
            break;
        case FileObserver.CLOSE_WRITE:
            parse = "file closed/writen";
            break;
        case FileObserver.ACCESS:
            //parse = "file accessed";
            break;
        case FileObserver.DELETE:
            parse = "file deleted";
            break;
        case FileObserver.OPEN:
            //parse = "file opened";
            break;
        case FileObserver.CLOSE_NOWRITE:
            //parse = "file closed/not writen";
            break;
        case FileObserver.ATTRIB:
            parse = "file attribs changed";
            break;
    }

    if(parse != null) {
        Logger.d(LOG, String.format("EVENT %d ON %s: %s", event, path, parse));
        //lsof_r1(path);

        ILogPack logPack = new ILogPack();
        logPack.put(Keys.FILE_EFFECTED, path);
        logPack.put(Keys.ACCESS_TYPE, parse);
        logPack.put(Keys.ACCESS_CODE, event);

        DeviceSucker.this.sendToBuffer(logPack);
    }
}
 
开发者ID:guardianproject,项目名称:CameraV,代码行数:43,代码来源:DeviceSucker.java

示例7: onEvent

@Override

    public void onEvent(int event, String path) {

        /*if (path == null) {

            return;

        }*/

        //a new file or subdirectory was created under the monitored directory

        /*if ((FileObserver.CREATE & event)!=0) {

            FileAccessLogStatic.accessLogMsg += absolutePath + "/" + path + " is created\n";

        }

        //a file or directory was opened

        if ((FileObserver.OPEN & event)!=0) {

            FileAccessLogStatic.accessLogMsg += path + " is opened\n";

        }*/

        //data was read from a file

        if ((FileObserver.ACCESS & event)!=0) {

            //FileAccessLogStatic.accessLogMsg += absolutePath + "/" + path + " is accessed/read\n";
            Log.i(TAG, "onEvent file " + absolutePath + path + " was accessed");

        }

        //data was written to a file

        if ((FileObserver.MODIFY & event)!=0) {

            if (getMimeType("" + absolutePath + "/" + path).split("/")[1].equals("pdf") || getMimeType("" + absolutePath + path).split("/")[1].equals("PDF")){
                //Log.i(TAG, "onEvent new pdf file detected " + absolutePath + path);
                Log.i("LogUhuru", "pdf#0#" + absolutePath + "/" + path);
            }

        }

    }
 
开发者ID:uhuru-mobile,项目名称:mobile-dashboard,代码行数:47,代码来源:MyFileObserver.java


注:本文中的android.os.FileObserver.ACCESS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。