本文整理汇总了Java中com.dd.plist.NSArray.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java NSArray.setValue方法的具体用法?Java NSArray.setValue怎么用?Java NSArray.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.dd.plist.NSArray
的用法示例。
在下文中一共展示了NSArray.setValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.dd.plist.NSArray; //导入方法依赖的package包/类
@Override
public void write(final Collection<S> collection, final Local file) throws AccessDeniedException {
final NSArray list = new NSArray(collection.size());
int i = 0;
for(S bookmark : collection) {
list.setValue(i, bookmark.<NSDictionary>serialize(SerializerFactory.get()));
i++;
}
final String content = list.toXMLPropertyList();
final OutputStream out = file.getOutputStream(false);
try {
IOUtils.write(content, out, Charset.forName("UTF-8"));
}
catch(IOException e) {
throw new AccessDeniedException(String.format("Cannot create file %s", file.getAbsolute()), e);
}
finally {
IOUtils.closeQuietly(out);
}
}
示例2: reloadBrowserList
import com.dd.plist.NSArray; //导入方法依赖的package包/类
static void reloadBrowserList(ArrayList<Browser> browserList) {
NSArray root = new NSArray(browserList.size());
for (int i = 0; i < browserList.size(); i++) {
NSDictionary browser = new NSDictionary();
browser.put(FIELD_NAME_BROWSER, browserList.get(i).getName());
browser.put(FIELD_NAME_CALL, browserList.get(i).getCall());
browser.put(FIELD_NAME_PRIVATE_CALL, browserList.get(i).getIncognitoCall());
root.setValue(i, browser);
}
try {
log.debug("Browser list location: " + ApplicationConstants.DEFAULT_LIST_LOCATION);
File file = new File(ApplicationConstants.DEFAULT_LIST_LOCATION);
PropertyListParser.saveAsXML(root, file);
} catch (IOException e) {
log.warn("Can not create .webloc file", e);
}
}
示例3: putValue
import com.dd.plist.NSArray; //导入方法依赖的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));
}
}
示例4: setListForKey
import com.dd.plist.NSArray; //导入方法依赖的package包/类
@Override
public <T extends Serializable> void setListForKey(final List<T> value, final String key) {
final NSArray list = new NSArray(value.size());
int i = 0;
for(Serializable serializable : value) {
list.setValue(i, serializable.<NSDictionary>serialize(SerializerFactory.get()));
i++;
}
dict.put(key, list);
}
示例5: addField
import com.dd.plist.NSArray; //导入方法依赖的package包/类
public void addField(String name, List<? extends PBXObject> objectList) {
NSArray array = new NSArray(objectList.size());
for (int i = 0; i < objectList.size(); i++) {
String gid = serializeObject(objectList.get(i));
array.setValue(i, new NSString(gid));
}
currentObject.put(name, array);
}
示例6: addField
import com.dd.plist.NSArray; //导入方法依赖的package包/类
public void addField(String name, List<? extends PBXObject> objectList) {
NSArray array = new NSArray(objectList.size());
for (int i = 0; i < objectList.size(); i++) {
String gid = serializeObject(objectList.get(i));
array.setValue(i, new NSString(gid));
}
Preconditions.checkNotNull(currentObject).put(name, array);
}