FileListingService

public final class FileListingService
extends Object

java.lang.Object
   ↳ com.android.ddmlib.FileListingService


IDevice 측면 파일 목록 서비스 제공

요약

중첩된 클래스

class FileListingService.FileEntry

디렉터리의 항목을 나타냅니다. 

interface FileListingService.IListingReceiver

이 인터페이스를 구현하는 클래스는 기기에서 ls 명령의 비동기 결과를 처리하는 메서드를 제공합니다. 

상수

String DIRECTORY_APP

애플리케이션 폴더

String DIRECTORY_DATA

최상위 데이터 폴더입니다.

String DIRECTORY_MNT

최상위 마운트 폴더입니다.

String DIRECTORY_SDCARD

최상위 sdcard 폴더입니다.

String DIRECTORY_SYSTEM

최상위 시스템 폴더입니다.

String DIRECTORY_TEMP

최상위 임시 폴더입니다.

String FILE_SEPARATOR

기기 측 파일 구분자입니다.

long REFRESH_RATE

int TYPE_BLOCK

항목 유형: 차단

int TYPE_CHARACTER

항목 유형: 문자

int TYPE_DIRECTORY

항목 유형: 디렉터리

int TYPE_DIRECTORY_LINK

항목 유형: 디렉터리 링크

int TYPE_FIFO

항목 유형: FIFO

int TYPE_FILE

항목 유형: 파일

int TYPE_LINK

항목 유형: 링크

int TYPE_OTHER

항목 유형: 기타

int TYPE_SOCKET

항목 유형: 소켓

필드

public static final Pattern LS_LD_PATTERN

public static final Pattern LS_L_PATTERN

ls의 결과를 파싱하는 정규식 패턴입니다.

public static final Pattern STAT_PATTERN

통계에서 결과를 파싱하는 정규식 패턴입니다.

공개 생성자

FileListingService(IDevice device)

지정된 IDevice의 파일 목록 서비스를 만듭니다.

공개 메서드

FileEntry[] getChildren(FileListingService.FileEntry entry, boolean useCache, FileListingService.IListingReceiver receiver)

FileEntry의 하위 요소를 반환합니다.

FileEntry[] getChildrenSync(FileListingService.FileEntry entry)

FileEntry의 하위 요소를 반환합니다.

FileListingService.FileEntry getRoot()

루트 요소를 반환합니다.

상수

DIRECTORY_APP

public static final String DIRECTORY_APP

애플리케이션 폴더

상수 값: 'app'

DIRECTORY_DATA

public static final String DIRECTORY_DATA

최상위 데이터 폴더입니다.

상수 값: 'data'

DIRECTORY_MNT

public static final String DIRECTORY_MNT

최상위 마운트 폴더입니다.

상수 값: 'mnt'

DIRECTORY_SDCARD

public static final String DIRECTORY_SDCARD

최상위 sdcard 폴더입니다.

상수 값: "sdcard"

DIRECTORY_SYSTEM

public static final String DIRECTORY_SYSTEM

최상위 시스템 폴더입니다.

상수 값: 'system'

DIRECTORY_TEMP

public static final String DIRECTORY_TEMP

최상위 임시 폴더입니다.

상수 값: 'tmp'

FILE_SEPARATOR

public static final String FILE_SEPARATOR

기기 측 파일 구분자입니다.

상수 값: '/'

REFRESH_RATE

public static final long REFRESH_RATE

상수 값: 5000 (0x0000000000001388)

TYPE_BLOCK

public static final int TYPE_BLOCK

항목 유형: 차단

상수 값: 3 (0x00000003)

TYPE_CHARACTER

public static final int TYPE_CHARACTER

항목 유형: 문자

상수 값: 4 (0x00000004)

TYPE_DIRECTORY

public static final int TYPE_DIRECTORY

항목 유형: 디렉터리

상수 값: 1 (0x00000001)

public static final int TYPE_DIRECTORY_LINK

항목 유형: 디렉터리 링크

상수 값: 2 (0x00000002)

TYPE_FIFO

public static final int TYPE_FIFO

항목 유형: FIFO

상수 값: 7 (0x00000007)

TYPE_FILE

public static final int TYPE_FILE

항목 유형: 파일

상수 값: 0 (0x00000000)

public static final int TYPE_LINK

항목 유형: 링크

상수 값: 5 (0x00000005)

TYPE_OTHER

public static final int TYPE_OTHER

항목 유형: 기타

상수 값: 8 (0x00000008)

TYPE_SOCKET

public static final int TYPE_SOCKET

항목 유형: 소켓

상수 값: 6 (0x00000006)

필드

LS_LD_PATTERN

public static final Pattern LS_LD_PATTERN

LS_L_PATTERN

public static final Pattern LS_L_PATTERN

ls의 결과를 파싱하는 정규식 패턴입니다.

STAT_PATTERN

public static final Pattern STAT_PATTERN

통계에서 결과를 파싱하는 정규식 패턴입니다. 예: drwxr-xr-x root root 2021-08-02 09:20:53.000000000 -0700 4096 /

공개 생성자

FileListingService

public FileListingService (IDevice device)

지정된 IDevice의 파일 목록 서비스를 만듭니다.

매개변수
device IDevice: 서비스가 연결된 기기입니다.

공개 메서드

getChildren

public FileEntry[] getChildren (FileListingService.FileEntry entry, 
                boolean useCache, 
                FileListingService.IListingReceiver receiver)

FileEntry의 하위 요소를 반환합니다.

이 메서드는 캐시 메커니즘과 동기 및 비동기 모드를 지원합니다.

receivernull이면 기기 측 ls 명령어가 동기적으로 실행되고 명령어 완료 시 메서드가 반환됩니다.
receivernull이 아닌 경우 명령어가 별도의 스레드에서 실행되며 완료되면 수신자에게 결과가 통지됩니다.

ls 명령어의 결과는 상위 FileEntry에 캐시됩니다. useCache는 이 캐시의 사용을 허용하지만 캐시가 유효한 경우에만 허용합니다. 캐시는 FileListingService.REFRESH_RATEms 동안만 유효합니다. 그 후에는 항상 새 ls 명령어가 실행됩니다.

캐시가 유효하고 useCache == true인 경우 메서드는 IListingReceiver이 제공되었는지 여부에 관계없이 항상 캐시 값을 반환합니다.

매개변수
entry FileListingService.FileEntry: 상위 항목입니다.

useCache boolean: 캐시를 사용하거나 새 ls 명령어를 강제하는 플래그입니다.

receiver FileListingService.IListingReceiver: 비동기 호출 수신기입니다.

반환 값
FileEntry[] 비동기 호출을 위한 자식 또는 null 목록입니다.

getChildrenSync

public FileEntry[] getChildrenSync (FileListingService.FileEntry entry)

FileEntry의 하위 요소를 반환합니다.

이 메서드는 getChildren(com.android.ddmlib.FileListingService.FileEntry, boolean, com.android.ddmlib.FileListingService.IListingReceiver)의 명시적 동기 버전입니다. 이는 getChildren(FileEntry, false, null)을 호출하는 것과 거의 동일합니다.

매개변수
entry FileListingService.FileEntry: 상위 항목입니다.

반환 값
FileEntry[] 자녀 목록

생성 값
TimeoutException 명령어를 전송할 때 연결이 시간 초과되는 경우
AdbCommandRejectedException adb가 명령어를 거부하는 경우
ShellCommandUnresponsiveException 셸 명령어가 maxTimeToOutputResponse보다 긴 기간 동안 출력을 전송하지 않는 경우
연결에 I/O 오류가 있는 경우

getRoot

public FileListingService.FileEntry getRoot ()

루트 요소를 반환합니다.

반환 값
FileListingService.FileEntry 루트 요소를 나타내는 FileEntry 객체 또는 기기가 유효하지 않은 경우 null