2025년 3월 27일부터 AOSP를 빌드하고 기여하려면 aosp-main
대신 android-latest-release
를 사용하는 것이 좋습니다. 자세한 내용은 AOSP 변경사항을 참고하세요.
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
JSONFileKeyStoreClient
public
class
JSONFileKeyStoreClient
extends Object
implements
IKeyStoreClient
java.lang.Object
|
↳ |
com.android.tradefed.util.keystore.JSONFileKeyStoreClient
|
로컬 JSON 파일이 키 저장소 역할을 하는 샘플 구현 JSON 텍스트 파일에는 문자열 형식의 키-값이 있어야 합니다.
요약
공개 메서드 |
boolean
|
containsKey(String key)
키 저장소에 지정된 키가 포함되어 있는지 확인하는 메서드입니다.
|
String
|
fetchKey(String key)
키 저장소 내에서 지정된 키를 가져오는 메서드입니다.
|
boolean
|
isAvailable()
통신할 유효한 키 저장소가 있는지 확인하는 메서드입니다.
|
void
|
setKeyStore(JSONObject keyStore)
키 저장소를 설정하는 데 사용되는 도우미 메서드입니다.
|
보호된 메서드 |
void
|
setKey(String key, String value)
key 를 value 에 매핑합니다.
|
필드
mJsonKeyStore
protected JSONObject mJsonKeyStore
공개 생성자
JSONFileKeyStoreClient
public JSONFileKeyStoreClient ()
JSONFileKeyStoreClient
public JSONFileKeyStoreClient (File jsonFile)
공개 메서드
containsKey
public boolean containsKey (String key)
키 저장소에 지정된 키가 포함되어 있는지 확인하는 메서드입니다.
매개변수 |
key |
String : 존재 여부를 확인합니다. |
반환 값 |
boolean |
지정된 키가 있는 경우 true입니다. |
fetchKey
public String fetchKey (String key)
키 저장소 내에서 지정된 키를 가져오는 메서드입니다.
매개변수 |
key |
String : 키 저장소 내에서 가져옵니다. |
반환 값 |
String |
키의 String 값입니다. 키를 찾을 수 없는 경우 null을 반환합니다. |
isAvailable
public boolean isAvailable ()
통신할 유효한 키 저장소가 있는지 확인하는 메서드입니다.
반환 값 |
boolean |
유효한 키 저장소가 있으면 true이고, 그렇지 않으면 false입니다. |
setKeyStore
public void setKeyStore (JSONObject keyStore)
키 저장소를 설정하는 데 사용되는 도우미 메서드입니다. 테스트에 사용됩니다.
매개변수 |
keyStore |
JSONObject : 키 저장소로 사용할 JSONObject 입니다. |
보호된 메서드
setKey
protected void setKey (String key,
String value)
key
를 value
에 매핑합니다. mJsonKeyStore.put(key, value)
와 같습니다.
매개변수 |
key |
String |
value |
String |
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# JSONFileKeyStoreClient\n======================\n\n\n`\npublic\n\n\nclass\nJSONFileKeyStoreClient\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\nimplements\n\n`[IKeyStoreClient](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/IKeyStoreClient.html)`\n\n\n`\n\n|---|-----------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.util.keystore.JSONFileKeyStoreClient |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA sample implementation where a local JSON file acts a key store. The JSON\ntext file should have key to value in string format.\n\nSummary\n-------\n\n| ### Fields ||\n|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| ` protected JSONObject` | [mJsonKeyStore](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#mJsonKeyStore) |\n\n| ### Public constructors ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[JSONFileKeyStoreClient](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#JSONFileKeyStoreClient())`() ` |\n| ` `[JSONFileKeyStoreClient](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#JSONFileKeyStoreClient(File))`(File jsonFile) ` |\n\n| ### Public methods ||\n|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` boolean` | ` `[containsKey](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#containsKey(java.lang.String))`(String key) ` A method to check if the key store contains a given key. |\n| ` String` | ` `[fetchKey](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#fetchKey(java.lang.String))`(String key) ` A method to fetch a given key inside the key store. |\n| ` boolean` | ` `[isAvailable](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#isAvailable())`() ` A method to check whether or not we have a valid key store to talk to. |\n| ` void` | ` `[setKeyStore](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#setKeyStore(org.json.JSONObject))`(JSONObject keyStore) ` Helper method used to set key store. |\n\n| ### Protected methods ||\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[setKey](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/JSONFileKeyStoreClient.html#setKey(java.lang.String,%20java.lang.String))`(String key, String value) ` Maps `key` to `value`. |\n\nFields\n------\n\n### mJsonKeyStore\n\n```\nprotected JSONObject mJsonKeyStore\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic constructors\n-------------------\n\n### JSONFileKeyStoreClient\n\n```\npublic JSONFileKeyStoreClient ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### JSONFileKeyStoreClient\n\n```\npublic JSONFileKeyStoreClient (File jsonFile)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|---------------|\n| `jsonFile` | `File` \u003cbr /\u003e |\n\n| Throws ||\n|------------------------------------------------------------------------------------------------------------------------|---|\n| [KeyStoreException](../../../../../../../reference/tradefed/com/android/tradefed/util/keystore/KeyStoreException.html) | |\n\nPublic methods\n--------------\n\n### containsKey\n\n```\npublic boolean containsKey (String key)\n```\n\nA method to check if the key store contains a given key.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|------------------------------------------|\n| `key` | `String`: to check existence for. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------|\n| `boolean` | true if the given key exists. \u003cbr /\u003e |\n\n### fetchKey\n\n```\npublic String fetchKey (String key)\n```\n\nA method to fetch a given key inside the key store.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|-------------------------------------------------|\n| `key` | `String`: to fetch inside the key store. \u003cbr /\u003e |\n\n| Returns ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `String` | the [String](../../../../../../../reference/tradefed/java/lang/String.html) value of the key. It will return null if key is not found. \u003cbr /\u003e |\n\n### isAvailable\n\n```\npublic boolean isAvailable ()\n```\n\nA method to check whether or not we have a valid key store to talk to.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|------------------------------------------------------------|\n| `boolean` | true if we have a valid key store, false otherwise. \u003cbr /\u003e |\n\n### setKeyStore\n\n```\npublic void setKeyStore (JSONObject keyStore)\n```\n\nHelper method used to set key store. Used for testing.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------------------|\n| `keyStore` | `JSONObject`: [JSONObject](../../../../../../../reference/tradefed/org/json/JSONObject.html) to use as key store. \u003cbr /\u003e |\n\nProtected methods\n-----------------\n\n### setKey\n\n```\nprotected void setKey (String key, \n String value)\n```\n\nMaps `key` to `value`. Equivalent to `mJsonKeyStore.put(key, value)`.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|-----------------|\n| `key` | `String` \u003cbr /\u003e |\n| `value` | `String` \u003cbr /\u003e |\n\n| Throws ||\n|-----------------|---|\n| `JSONException` | |"]]