本文整理汇总了Java中com.dd.plist.NSString类的典型用法代码示例。如果您正苦于以下问题:Java NSString类的具体用法?Java NSString怎么用?Java NSString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSString类属于com.dd.plist包,在下文中一共展示了NSString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: listConfigurationProfiles
import com.dd.plist.NSString; //导入依赖的package包/类
@Override
public ImmutableList<ConfigurationProfile> listConfigurationProfiles() throws IosDeviceException {
String plistXml = await(cfgutil.get("configurationProfiles"));
NSDictionary plist = (NSDictionary) PlistParser.fromXml(plistXml);
String ecid = ((NSArray) plist.get("Devices")).objectAtIndex(0).toString();
NSDictionary output = (NSDictionary) ((NSDictionary) plist.get("Output")).get(ecid);
NSArray profileArray = (NSArray) output.get("configurationProfiles");
ImmutableList.Builder<ConfigurationProfile> profiles = ImmutableList.builder();
for (int i = 0; i < profileArray.count(); i++) {
NSDictionary profileDict = (NSDictionary) profileArray.objectAtIndex(i);
profiles.add(
ConfigurationProfile.builder()
.displayName(((NSString) profileDict.get("displayName")).getContent())
.identifier(((NSString) profileDict.get("identifier")).getContent())
.version(((NSNumber) profileDict.get("version")).intValue())
.build());
}
return profiles.build();
}
开发者ID:google,项目名称:ios-device-control,代码行数:21,代码来源:RealDeviceImpl.java
示例2: updateRootPlistPreferenceSpecifiersKeyDefaultValue
import com.dd.plist.NSString; //导入依赖的package包/类
public static void updateRootPlistPreferenceSpecifiersKeyDefaultValue(File plistFile, String keyToUpdate, String valueToSet) throws IOException {
BackupUtil.backupFile(plistFile);
NSDictionary rootDict = PlistUtil.getRootDictionary(plistFile);
boolean plistModified = false;
for (Map.Entry<String, NSObject> subRootEntry : rootDict.entrySet()) {
if ("PreferenceSpecifiers".equals(subRootEntry.getKey())
&& subRootEntry.getValue() instanceof NSArray
&& "com.dd.plist.NSArray".equals(subRootEntry.getValue().getClass().getCanonicalName())) {
NSObject[] psArray = ((NSArray)subRootEntry.getValue()).getArray();
NSDictionary psDict = (NSDictionary)psArray[0];
for (Map.Entry<String, NSObject> psEntry : psDict.entrySet()) {
if (keyToUpdate.equals(psEntry.getKey())) {
psEntry.setValue(new NSString(valueToSet));
plistModified = true;
logger.info(" Replacing key '{}' with value '{}'", psEntry.getKey(), valueToSet);
}
}
}
}
if (plistModified) {
PropertyListParser.saveAsXML(rootDict, plistFile.getAbsoluteFile());
logger.info(" current md5={}", CommonUtil.getMD5Hex(plistFile));
}
}
开发者ID:ctco,项目名称:gradle-mobile-plugin,代码行数:25,代码来源:ProfilingUtil.java
示例3: putValue
import com.dd.plist.NSString; //导入依赖的package包/类
private void putValue(NSDictionary dictionary, String key, String value)
{
boolean isArray = value.charAt(0) == '[';
if (isArray)
{
String[] values = value.substring(1, value.length() - 1).split(","); //$NON-NLS-1$
NSArray array = new NSArray(values.length);
for (int ii = 0; ii < values.length; ii++)
array.setValue(ii, new NSString(values[ii]));
dictionary.put(key, array);
}
else
{
dictionary.put(key, new NSString(value));
}
}
开发者ID:buchen,项目名称:fix-info-plist-maven-plugin,代码行数:18,代码来源:FixInfoPlistMojo.java
示例4: recover
import com.dd.plist.NSString; //导入依赖的package包/类
static NSDictionary recover(
HttpClient httpClient,
EscrowProxyRequestFactory requests,
SRPClient srpClient,
NSDictionary srpInitResponse) throws IOException {
validateSrpInitResponse(srpInitResponse);
String dsid = PListsLegacy.getAs(srpInitResponse, "dsid", NSString.class).getContent();
String respBlob = PListsLegacy.getAs(srpInitResponse, "respBlob", NSString.class).getContent();
BlobA4 blob = blobA4(respBlob);
byte[] m1 = calculateM1(srpClient, blob, dsid);
byte[] uid = blob.uid();
byte[] tag = blob.tag();
return recover(httpClient, requests, uid, tag, m1);
}
开发者ID:horrorho,项目名称:InflatableDonkey,代码行数:20,代码来源:EscrowOperationsRecover.java
示例5: from
import com.dd.plist.NSString; //导入依赖的package包/类
public static Optional<InflatableData> from(byte[] bs) {
InflatableData data;
try {
NSDictionary parse = (NSDictionary) PropertyListParser.parse(bs);
byte[] escrowedKeys = ((NSData) parse.get("escrowedKeys")).bytes();
UUID deviceUuid = UUID.fromString(((NSString) parse.get("deviceUuid")).getContent());
String deviceHardWareId = ((NSString) parse.get("deviceHardWareId")).getContent();
data = new InflatableData(escrowedKeys, deviceUuid, deviceHardWareId);
} catch (ClassCastException | IllegalArgumentException | IOException | NullPointerException
| PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
logger.warn("-- from() - exception: ", ex);
data = null;
}
return Optional.ofNullable(data);
}
开发者ID:horrorho,项目名称:InflatableDonkey,代码行数:17,代码来源:InflatableData.java
示例6: testAddPluginFile
import com.dd.plist.NSString; //导入依赖的package包/类
@Test
public void testAddPluginFile() throws Exception{
PBXProject project = new PBXProject(pbxFile);
String testPath = "my/files/abc.h";
PBXFile file = new PBXFile(testPath);
project.addPluginFile(file);
NSDictionary dict = (NSDictionary)ASCIIPropertyListParser.parse(project.getContent().getBytes());
NSDictionary objects = (NSDictionary)dict.objectForKey("objects");
NSDictionary fileRef = (NSDictionary) objects.objectForKey(file.getFileRef());
assertNotNull(fileRef);
NSString isa = (NSString)fileRef.get("isa");
assertEquals("PBXFileReference",isa.getContent());
NSString path = (NSString)fileRef.get("path");
assertEquals(testPath, path.getContent());
NSString lastType = (NSString)fileRef.get("lastKnownFileType");
assertEquals(HEADER_FILE, lastType.getContent());
NSString encoding = (NSString)fileRef.get("fileEncoding");
assertEquals("4", encoding.getContent());
NSString sourceTree = (NSString)fileRef.get("sourceTree");
assertEquals(DEFAULT_GROUP, sourceTree.getContent());
assertTrue("No entry found on the Plugins group",isFileEntryFoundOnPluginsGroup(file, objects));
}
开发者ID:eclipse,项目名称:thym,代码行数:27,代码来源:PBXProjectTest.java
示例7: testAddFrameworkWithWeak
import com.dd.plist.NSString; //导入依赖的package包/类
@Test
public void testAddFrameworkWithWeak() throws Exception{
PBXProject project = new PBXProject(pbxFile);
String testPath = "libsqlite3.dylib";
PBXFile file = new PBXFile(testPath);
file.setWeak(true);
project.addFramework(file);
NSDictionary dict = (NSDictionary)ASCIIPropertyListParser.parse(project.getContent().getBytes());
NSDictionary objects = (NSDictionary)dict.objectForKey("objects");
NSDictionary buildFile = (NSDictionary)objects.objectForKey(file.getUuid());
assertNotNull(buildFile);
NSString isa = (NSString) buildFile.get("isa");
assertEquals("PBXBuildFile",isa.getContent());
NSString fRef = (NSString) buildFile.get("fileRef");
assertEquals(file.getFileRef(), fRef.getContent());
NSDictionary settings = (NSDictionary) buildFile.get("settings");
NSArray attributes = (NSArray) settings.get("ATTRIBUTES");
assertTrue(attributes.containsObject(NSObject.wrap("Weak")));
}
开发者ID:eclipse,项目名称:thym,代码行数:22,代码来源:PBXProjectTest.java
示例8: testAddToLibrarySearchPaths
import com.dd.plist.NSString; //导入依赖的package包/类
@Test
public void testAddToLibrarySearchPaths() throws Exception{
PBXProject project = new PBXProject(pbxFile);
String testPath = "my/files/abcd.h";
PBXFile file = new PBXFile(testPath);
project.addToLibrarySearchPaths(file);
NSDictionary dict = (NSDictionary)ASCIIPropertyListParser.parse(project.getContent().getBytes());
NSDictionary objects = (NSDictionary)dict.objectForKey("objects");
HashMap<String, NSObject> hashmap = objects.getHashMap();
Collection<NSObject> values = hashmap.values();
for (NSObject nsObject : values) {
NSDictionary obj = (NSDictionary) nsObject;
NSString isa = (NSString) obj.objectForKey("isa");
if(isa != null && isa.getContent().equals("XCBuildConfiguration")){
NSDictionary buildSettings = (NSDictionary) obj.objectForKey("buildSettings");
assertTrue(buildSettings.containsKey("LIBRARY_SEARCH_PATHS"));
NSArray searchPaths = (NSArray) buildSettings.get("LIBRARY_SEARCH_PATHS");
assertEquals("$(SRCROOT)/Test_Application/my/files", ((NSString)searchPaths.objectAtIndex(1)).getContent());
}
}
}
开发者ID:eclipse,项目名称:thym,代码行数:24,代码来源:PBXProjectTest.java
示例9: searchPathForFile
import com.dd.plist.NSString; //导入依赖的package包/类
private NSString searchPathForFile(PBXFile pbxfile) throws PBXProjectException {
String filepath = FilenameUtils.getFullPathNoEndSeparator(pbxfile.getPath());
if(filepath.equals(".")){
filepath = "";
}else{
filepath = "/"+filepath;
}
NSDictionary group = getGroupByName("Plugins");
if(pbxfile.isPlugin() && group.containsKey("path")){
NSString groupPath = (NSString)group.objectForKey("path");
return NSObject.wrap("$(SRCROOT)/" + groupPath.getContent().replace('"', ' ').trim());
}
else{
return NSObject.wrap("$(SRCROOT)/"+ getProductName() + filepath );
}
}
开发者ID:eclipse,项目名称:thym,代码行数:18,代码来源:PBXProject.java
示例10: getProductName
import com.dd.plist.NSString; //导入依赖的package包/类
public String getProductName() throws PBXProjectException {
HashMap<String, NSObject> hashmap = getObjects().getHashMap();
Collection<NSObject> values = hashmap.values();
for (NSObject nsObject : values) {
NSDictionary obj = (NSDictionary) nsObject;
NSString isa = (NSString) obj.objectForKey("isa");
if(isa != null && isa.getContent().equals("XCBuildConfiguration")){
NSDictionary buildSettings = (NSDictionary) obj.objectForKey("buildSettings");
if( buildSettings.containsKey("PRODUCT_NAME")){
NSString name = (NSString) buildSettings.get("PRODUCT_NAME");
return name.getContent().replace('"', ' ').trim();
}
}
}
return null;
}
开发者ID:eclipse,项目名称:thym,代码行数:17,代码来源:PBXProject.java
示例11: setBundleIdentifier
import com.dd.plist.NSString; //导入依赖的package包/类
/**
* Sets the given identifier on this merged plist in the {@code CFBundleIdentifier}
* attribute.
*
* @param primaryIdentifier used to set the bundle identifier or override the existing one from
* plist file, can be null
* @param fallbackIdentifier used to set the bundle identifier if it is not set by plist file or
* primary identifier, can be null
* @return this plist merging
*/
public PlistMerging setBundleIdentifier(String primaryIdentifier, String fallbackIdentifier) {
NSString bundleIdentifier = (NSString) merged.get(BUNDLE_IDENTIFIER_PLIST_KEY);
if (primaryIdentifier != null) {
merged.put(BUNDLE_IDENTIFIER_PLIST_KEY, convertToRFC1034(primaryIdentifier));
} else if (bundleIdentifier == null) {
if (fallbackIdentifier != null) {
merged.put(BUNDLE_IDENTIFIER_PLIST_KEY, convertToRFC1034(fallbackIdentifier));
} else {
// TODO(bazel-team): We shouldn't be generating an info.plist in this case.
merged.put(BUNDLE_IDENTIFIER_PLIST_KEY, BUNDLE_IDENTIFIER_DEFAULT);
}
}
return this;
}
开发者ID:bazelbuild,项目名称:bazel,代码行数:27,代码来源:PlistMerging.java
示例12: getDefaultPropertiesFromNSDictionary
import com.dd.plist.NSString; //导入依赖的package包/类
private static void getDefaultPropertiesFromNSDictionary(
NSDictionary sdkSettingsDict,
ImmutableMap.Builder<String, String> defaultPropertiesBuilder) {
NSObject defaultProperties = sdkSettingsDict.objectForKey(DEFAULT_PROPERTIES_KEY);
if (!(defaultProperties instanceof NSDictionary)) {
throw new RuntimeException(
"Unexpected " + DEFAULT_PROPERTIES_KEY + " contents (expected NSDictionary, got " +
defaultProperties + ")");
}
NSDictionary defaultPropertiesDict = (NSDictionary) defaultProperties;
for (String key : defaultPropertiesDict.allKeys()) {
NSObject value = defaultPropertiesDict.objectForKey(key);
if (!(value instanceof NSString)) {
throw new RuntimeException(
"Unexpected key " + key + " contents (expected NSString, got " +
value + ")");
}
NSString stringValue = (NSString) value;
defaultPropertiesBuilder.put(key, stringValue.toString());
}
}
开发者ID:saleehk,项目名称:buck-cutom,代码行数:22,代码来源:SDKSettings.java
示例13: testEmptyProject
import com.dd.plist.NSString; //导入依赖的package包/类
@Test
public void testEmptyProject() {
PBXProject project = new PBXProject("TestProject");
XcodeprojSerializer xcodeprojSerializer = new XcodeprojSerializer(
new GidGenerator(ImmutableSet.<String>of()), project);
NSDictionary rootObject = xcodeprojSerializer.toPlist();
assertEquals(project.getGlobalID(), ((NSString) rootObject.get("rootObject")).getContent());
NSDictionary objects = ((NSDictionary) rootObject.get("objects"));
NSDictionary projectObject = (NSDictionary) objects.get(project.getGlobalID());
String[] requiredKeys = {
"mainGroup",
"targets",
"buildConfigurationList",
"compatibilityVersion",
"attributes",
};
for (String key : requiredKeys) {
assertTrue(projectObject.containsKey(key));
}
}
开发者ID:saleehk,项目名称:buck-cutom,代码行数:25,代码来源:XcodeprojSerializerTest.java
示例14: getDefaultPropertiesFromNSDictionary
import com.dd.plist.NSString; //导入依赖的package包/类
private static void getDefaultPropertiesFromNSDictionary(
NSDictionary sdkSettingsDict, ImmutableMap.Builder<String, String> defaultPropertiesBuilder) {
NSObject defaultProperties = sdkSettingsDict.objectForKey(DEFAULT_PROPERTIES_KEY);
if (!(defaultProperties instanceof NSDictionary)) {
throw new RuntimeException(
"Unexpected "
+ DEFAULT_PROPERTIES_KEY
+ " contents (expected NSDictionary, got "
+ defaultProperties
+ ")");
}
NSDictionary defaultPropertiesDict = (NSDictionary) defaultProperties;
for (String key : defaultPropertiesDict.allKeys()) {
NSObject value = defaultPropertiesDict.objectForKey(key);
if (!(value instanceof NSString)) {
throw new RuntimeException(
"Unexpected key " + key + " contents (expected NSString, got " + value + ")");
}
NSString stringValue = (NSString) value;
defaultPropertiesBuilder.put(key, stringValue.toString());
}
}
开发者ID:facebook,项目名称:buck,代码行数:23,代码来源:SDKSettings.java
示例15: testHandlesNonDictionaryPlists
import com.dd.plist.NSString; //导入依赖的package包/类
@Test
public void testHandlesNonDictionaryPlists() throws Exception {
FakeProjectFilesystem projectFilesystem = new FakeProjectFilesystem();
PlistProcessStep plistProcessStep =
new PlistProcessStep(
projectFilesystem,
INPUT_PATH,
Optional.empty(),
OUTPUT_PATH,
ImmutableMap.of(),
ImmutableMap.of("Key1", new NSString("OverrideValue")),
PlistProcessStep.OutputFormat.XML);
NSArray array = new NSArray(new NSString("Value1"), new NSString("Value2"));
projectFilesystem.writeContentsToPath(array.toXMLPropertyList(), INPUT_PATH);
ExecutionContext executionContext = TestExecutionContext.newInstance();
int errorCode = plistProcessStep.execute(executionContext).getExitCode();
assertThat(errorCode, equalTo(0));
assertThat(
projectFilesystem.readFileIfItExists(OUTPUT_PATH),
equalTo(Optional.of(array.toXMLPropertyList())));
}
开发者ID:facebook,项目名称:buck,代码行数:26,代码来源:PlistProcessStepTest.java
示例16: testEmptyProject
import com.dd.plist.NSString; //导入依赖的package包/类
@Test
public void testEmptyProject() {
PBXProject project = new PBXProject("TestProject");
XcodeprojSerializer xcodeprojSerializer = new XcodeprojSerializer(new GidGenerator(), project);
NSDictionary rootObject = xcodeprojSerializer.toPlist();
assertEquals(project.getGlobalID(), ((NSString) rootObject.get("rootObject")).getContent());
NSDictionary objects = ((NSDictionary) rootObject.get("objects"));
NSDictionary projectObject = (NSDictionary) objects.get(project.getGlobalID());
String[] requiredKeys = {
"mainGroup", "targets", "buildConfigurationList", "compatibilityVersion", "attributes",
};
for (String key : requiredKeys) {
assertTrue(projectObject.containsKey(key));
}
}
开发者ID:facebook,项目名称:buck,代码行数:20,代码来源:XcodeprojSerializerTest.java
示例17: listForKey
import com.dd.plist.NSString; //导入依赖的package包/类
@Override
public <T> List<T> listForKey(final String key) {
final NSObject value = dict.objectForKey(key);
if(null == value) {
return null;
}
if(value instanceof NSArray) {
final NSArray array = (NSArray) value;
final List<T> list = new ArrayList<T>();
for(int i = 0; i < array.count(); i++) {
final NSObject next = array.objectAtIndex(i);
if(next instanceof NSDictionary) {
list.add((T) next);
}
else if(next instanceof NSString) {
list.add((T) next.toString());
}
else {
log.warn(String.format("Ignore content of type %s", next));
}
}
return list;
}
log.warn(String.format("Unexpected value type for serialized key %s", key));
return null;
}
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:28,代码来源:PlistDeserializer.java
示例18: fromPlist
import com.dd.plist.NSString; //导入依赖的package包/类
/** Converts the given plist to an inspector message. */
public static InspectorMessage fromPlist(NSDictionary plist) {
try {
NSString selectorString = (NSString) plist.get(SELECTOR_KEY);
NSDictionary argumentDict = (NSDictionary) plist.get(ARGUMENT_KEY);
MessageSelector selector = MessageSelector.forString(selectorString.getContent());
Builder messageBuilder = selector.newMessageBuilder();
messageBuilder.populateFromPlistDict(argumentDict);
return messageBuilder.build();
} catch (RuntimeException e) {
throw new IllegalArgumentException("Invalid plist: " + plist.toXMLPropertyList(), e);
}
}
开发者ID:google,项目名称:ios-device-control,代码行数:14,代码来源:InspectorMessage.java
示例19: parseHashVals
import com.dd.plist.NSString; //导入依赖的package包/类
private void parseHashVals() {
hashVals = new HashMap<>();
if (root.containsKey(KEY_HASHVALS)) {
NSDictionary hashValsDict = (NSDictionary) root.objectForKey(KEY_HASHVALS);
Set<Map.Entry<String, NSObject>> set = hashValsDict.entrySet();
for (Map.Entry<String, NSObject> stringNSObjectEntry : set) {
hashVals.put(stringNSObjectEntry.getKey(), ((NSString) stringNSObjectEntry.getValue()).getContent());
}
}
}
开发者ID:die-tageszeitung,项目名称:tazapp-android,代码行数:11,代码来源:Paper.java
示例20: intValueIgnoresSubsequentCharacters
import com.dd.plist.NSString; //导入依赖的package包/类
@Test
public void intValueIgnoresSubsequentCharacters() {
NSString s = new NSString(" 42 is the meaning of life. 12345678.");
assertEquals(42, s.intValue());
NSString s2 = new NSString("1234five");
assertEquals(1234, s2.intValue());
}
开发者ID:3breadt,项目名称:dd-plist,代码行数:9,代码来源:NSStringTest.java
注:本文中的com.dd.plist.NSString类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论