Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2002-2019 Drew Noakes and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* More information about this project is available at:
*
* https://drewnoakes.com/code/exif/
* https://github.com/drewnoakes/metadata-extractor
*/
package com.drew.metadata.plist;
import java.io.IOException;
import java.util.*;
import com.drew.lang.SequentialByteArrayReader;
import com.drew.lang.annotations.Nullable;
/**
* A limited-functionality binary property list (BPLIST) utility.
* Parser functionality accounts for "dict" (with simple integer and string values) and "data".
*
* https://opensource.apple.com/source/CF/CF-550/ForFoundationOnly.h
* https://opensource.apple.com/source/CF/CF-550/CFBinaryPList.c
* https://synalysis.com/how-to-decode-apple-binary-property-list-files/
*
* @author Bob Johnson
*/
public class BplistReader
{
private static final String PLIST_DTD = "";
private static final byte[] BPLIST_HEADER = {'b', 'p', 'l', 'i', 's', 't', '0', '0'};
/**
* Ensure that a BPLIST is valid.
*/
public static boolean isValid(byte[] bplist)
{
if (bplist.length < BPLIST_HEADER.length) {
return false;
}
boolean valid = true;
for (int i = 0; i < BPLIST_HEADER.length; i++) {
if (bplist[i] != BPLIST_HEADER[i]) {
valid = false;
break;
}
}
return valid;
}
public static PropertyListResults parse(byte[] bplist) throws IOException
{
if (!isValid(bplist)) {
throw new IllegalArgumentException("Input is not a bplist");
}
final ArrayList