本文整理汇总了Java中com.dd.plist.PropertyListFormatException类的典型用法代码示例。如果您正苦于以下问题:Java PropertyListFormatException类的具体用法?Java PropertyListFormatException怎么用?Java PropertyListFormatException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyListFormatException类属于com.dd.plist包,在下文中一共展示了PropertyListFormatException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRunJob
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
@NonNull
@Override
protected Result onRunJob(Params params) {
PersistableBundleCompat extras = params.getExtras();
long paperId = extras.getLong(ARG_PAPER_ID, -1L);
Paper paper = Paper.getPaperWithId(getContext(), paperId);
if (paper != null) {
try {
Timber.i("%s", paper);
StorageManager storageManager = StorageManager.getInstance(getContext());
currentPaperId = paperId;
currentUnzipPaper = new UnzipPaper(paper,
storageManager.getDownloadFile(paper),
storageManager.getPaperDirectory(paper),
true);
currentUnzipPaper.getUnzipFile()
.addProgressListener(this);
currentUnzipPaper.start();
savePaper(paper, null);
} catch (ParserConfigurationException | IOException | SAXException | ParseException | PropertyListFormatException | UnzipCanceledException e) {
savePaper(paper, e);
}
}
return Result.SUCCESS;
}
示例2: onRunJob
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
@NonNull
@Override
protected Result onRunJob(Params params) {
PersistableBundleCompat extras = params.getExtras();
String resourceKey = extras.getString(ARG_RESOURCE_KEY, null);
if (!TextUtils.isEmpty(resourceKey)) {
Resource resource = Resource.getWithKey(getContext(), resourceKey);
Timber.i("%s", resource);
if (resource != null && resource.isDownloading()) {
StorageManager storageManager = StorageManager.getInstance(getContext());
try {
UnzipResource unzipResource = new UnzipResource(storageManager.getDownloadFile(resource),
storageManager.getResourceDirectory(resource.getKey()),
true);
unzipResource.start();
saveResource(resource, null);
} catch (UnzipCanceledException | IOException | PropertyListFormatException | ParseException | SAXException | ParserConfigurationException e) {
saveResource(resource, e);
}
}
}
return Result.SUCCESS;
}
示例3: Plist
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
public Plist(InputStream is, boolean parseIndex) throws IOException, PropertyListFormatException, ParseException,
ParserConfigurationException, SAXException {
root = (NSDictionary) PropertyListParser.parse(is);
is.close();
archiveUrl = PlistHelper.getString(root, KEY_ARCHIVEURL);
bookId = PlistHelper.getString(root, KEY_BOOKID);
resource = PlistHelper.getString(root, KEY_RESOURCE);
if (!TextUtils.isEmpty(resource)) {
resource = resource.replace(".res", "");
}
minVersion = PlistHelper.getString(root, KEY_MINVERSION);
version = PlistHelper.getString(root, KEY_VERSION);
parseHashVals();
if (parseIndex) {
parseSources();
parseToplinks();
}
}
示例4: onHandleIntent
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
String resourceKey = intent.getStringExtra(PARAM_RESOURCE_KEY);
Timber.i("Start service after downloaded for resource: %s", resourceKey);
if (!TextUtils.isEmpty(resourceKey)) {
Resource resource = Resource.getWithKey(this,resourceKey);
Timber.i("%s",resource);
if (resource.isDownloading()) {
StorageManager storageManager = StorageManager.getInstance(this);
try {
UnzipResource unzipResource = new UnzipResource(storageManager.getDownloadFile(resource),storageManager.getResourceDirectory(resource.getKey()),true);
unzipResource.start();
saveResource(resource, null);
} catch (UnzipCanceledException|IOException | PropertyListFormatException | ParseException | SAXException | ParserConfigurationException e) {
saveResource(resource,e);
}
}
}
Timber.i("Finished service after download for resource: %s", resourceKey);
}
示例5: from
import com.dd.plist.PropertyListFormatException; //导入依赖的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);
}
示例6: handleEntity
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
@Override
public T handleEntity(HttpEntity entity) throws IOException {
NSObject nsObject;
try {
// Avoiding PropertyListParser#parse(InputStream) as the current Maven build (1.16) can bug out.
nsObject = PropertyListParser.parse(EntityUtils.toByteArray(entity));
} catch (PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
throw new BadDataException("failed to parse property list", ex);
}
if (to.isAssignableFrom(nsObject.getClass())) {
return to.cast(nsObject);
}
throw new BadDataException("failed to cast property list: " + nsObject.getClass());
}
示例7: read
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
private NSDictionary read(final Local file) {
try {
return (NSDictionary) XMLPropertyListParser.parse(file.getInputStream());
}
catch(ParserConfigurationException
| IOException
| SAXException
| PropertyListFormatException
| ParseException
| AccessDeniedException e) {
log.warn(String.format("Failure %s reading dictionary from %s", e.getMessage(), file));
}
return null;
}
示例8: parse
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
private NSObject parse(final Local file) throws AccessDeniedException {
try {
return XMLPropertyListParser.parse(file.getInputStream());
}
catch(ParserConfigurationException | IOException | SAXException | ParseException | PropertyListFormatException e) {
log.error(String.format("Invalid bookmark file %s", file));
return null;
}
}
示例9: callIdeviceInfo
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
private NSDictionary callIdeviceInfo() throws IosDeviceException {
String infoText = await(idevice.info("-x"));
byte[] infoBytes = infoText.getBytes(StandardCharsets.UTF_8);
try {
return (NSDictionary) XMLPropertyListParser.parse(infoBytes);
} catch (ParserConfigurationException
| ParseException
| PropertyListFormatException
| IOException
| SAXException e) {
throw new IosDeviceException(RealDeviceImpl.this, e);
}
}
示例10: fromPath
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
/**
* Parses the content of a plist file as UTF-8 encoded XML.
*
* @throws PlistParseException - if there is an error parsing the content.
*/
public static NSObject fromPath(Path plist) {
try {
return PropertyListParser.parse(Files.readAllBytes(plist));
} catch (ParserConfigurationException
| ParseException
| PropertyListFormatException
| IOException
| SAXException e) {
throw new PlistParseException(e);
}
}
示例11: fromXml
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
/**
* Parses an XML string to a plist object.
*
* @throws PlistParseException - if there is an error parsing the string.
*/
public static NSObject fromXml(String xml) {
try {
return XMLPropertyListParser.parse(xml.getBytes(UTF_8));
} catch (ParserConfigurationException
| ParseException
| PropertyListFormatException
| IOException
| SAXException e) {
throw new PlistParseException(e);
}
}
示例12: fromBinary
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
/**
* Parses a byte array to a plist object.
*
* @throws PlistParseException - if there is an error parsing the bytes.
*/
public static NSObject fromBinary(byte[] bytes) {
try {
return BinaryPropertyListParser.parse(bytes);
} catch (UnsupportedEncodingException | PropertyListFormatException e) {
throw new PlistParseException(e);
}
}
示例13: onHandleIntent
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
if (intent.getBooleanExtra(PARAM_CANCEL_BOOL, false)) return;
long paperId = intent.getLongExtra(PARAM_PAPER_ID, -1);
Timber.i("Start service after download for paper: %d", paperId);
Paper paper = Paper.getPaperWithId(this, paperId);
if (paper != null) {
if (canceledPapersIds.contains(paperId)) {
canceledPapersIds.remove(paperId);
paper.delete(this);
return;
}
try {
Timber.i("%s", paper);
StorageManager storageManager = StorageManager.getInstance(this);
currentPaperId = paperId;
currentUnzipPaper = new UnzipPaper(paper,
storageManager.getDownloadFile(paper),
storageManager.getPaperDirectory(paper),
true);
currentUnzipPaper.getUnzipFile()
.addProgressListener(this);
currentUnzipPaper.start();
savePaper(paper, null);
} catch (ParserConfigurationException | IOException | SAXException | ParseException | PropertyListFormatException | UnzipCanceledException e) {
savePaper(paper, e);
}
}
Timber.i("Finished service after download for paper: %d", paperId);
}
示例14: start
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
public File start() throws PropertyListFormatException, ParserConfigurationException, SAXException, ParseException, IOException, UnzipCanceledException {
unzipFile.getProgress()
.setProgressPercentageMax(50);
File result = unzipFile.start();
unzipFile.getProgress()
.setOffset(50);
checkCanceled();
Timber.i("... start parsing plist to check hashvals.");
if (!destinationDir.exists() || !destinationDir.isDirectory()) throw new FileNotFoundException("Directory not found");
File plistFile = new File(destinationDir, Paper.CONTENT_PLIST_FILENAME);
if (!plistFile.exists()) throw new FileNotFoundException("Plist not found");
paper.parsePlist(plistFile, false);
Map<String, String> hashVals = paper.getPlist()
.getHashVals();
if (hashVals != null) {
int count = 0;
for (Map.Entry<String, String> entry : hashVals.entrySet()) {
checkCanceled();
count++;
unzipFile.getProgress()
.setPercentage((count * 100) / hashVals.size());
unzipFile.notifyListeners(unzipFile.getProgress());
File checkFile = new File(destinationDir, entry.getKey());
if (!checkFile.exists()) throw new FileNotFoundException(checkFile.getName() + " not found");
else {
try {
if (!HashHelper.verifyHash(checkFile, entry.getValue(), HashHelper.SHA_1))
throw new FileNotFoundException("Wrong hash for file " + checkFile.getName());
} catch (NoSuchAlgorithmException e) {
Timber.w(e);
}
}
}
} else Timber.w("No hash values found in Plist");
checkCanceled();
Timber.i("... finished");
return result;
}
示例15: parseTpaper
import com.dd.plist.PropertyListFormatException; //导入依赖的package包/类
private static ImportMetadata parseTpaper(InputStream is) throws ParserConfigurationException, ParseException, SAXException, PropertyListFormatException, IOException {
Paper paper = new Paper();
paper.parsePlist(is, false);
if (paper.getPlist() != null) {
ImportMetadata result = new ImportMetadata();
result.setType(TYPE.TPAPER);
result.setBookId(paper.getPlist()
.getBookId());
result.setArchive(paper.getPlist().getArchiveUrl());
parseTitleAndDateFromBookId(result,paper.getPlist()
.getBookId());
return result;
}
return null;
}