Package com.dd.plist
Class BinaryPropertyListWriter
java.lang.Object
com.dd.plist.BinaryPropertyListWriter
Writes property lists in the binary format.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate intprivate final OutputStreamprivate intprivate static final intprivate static final intprivate static final intprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionBinaryPropertyListWriter(OutputStream outStr, int version) Creates a new binary property list writer -
Method Summary
Modifier and TypeMethodDescription(package private) voidprivate static intcomputeIdSizeInBytes(int numberOfIds) private intcomputeOffsetSizeInBytes(long maxOffset) (package private) intprivate static intFinds out the minimum binary property list format version that can be used to save the given NSObject tree.(package private) voidwrite(byte[] bytes) (package private) voidwrite(int b) (package private) voidstatic voidWrites a binary plist file with the given object as the root.static voidWrites a binary plist file with the given object as the root.static voidwrite(NSObject root, OutputStream out) Writes a binary plist serialization of the given object as the root.static voidWrites a binary plist file with the given object as the root.static voidDeprecated.Use the overload that takes the root as first argument and the file as second.static voidwrite(OutputStream out, NSObject root) Deprecated.Use the overload that takes the root as first argument and the stream as second.(package private) voidwriteBytes(long value, int bytes) (package private) voidwriteDouble(double value) (package private) voidwriteID(int id) (package private) voidwriteIntHeader(int kind, int value) (package private) voidwriteLong(long value) static byte[]writeToArray(NSObject root) Writes a binary plist serialization of the given object as the root into a byte array.
-
Field Details
-
VERSION_00
private static final int VERSION_00- See Also:
-
VERSION_10
private static final int VERSION_10- See Also:
-
VERSION_15
private static final int VERSION_15- See Also:
-
VERSION_20
private static final int VERSION_20- See Also:
-
version
private int version -
out
-
count
private long count -
idMap
-
idSizeInBytes
private int idSizeInBytes
-
-
Constructor Details
-
BinaryPropertyListWriter
BinaryPropertyListWriter(OutputStream outStr, int version) Creates a new binary property list writer- Parameters:
outStr- The output stream into which the binary property list will be writtenversion- The binary property list format version.
-
-
Method Details
-
getMinimumRequiredVersion
Finds out the minimum binary property list format version that can be used to save the given NSObject tree.- Parameters:
root- Object root- Returns:
- Version code
-
write
Deprecated.Use the overload that takes the root as first argument and the file as second.Writes a binary plist file with the given object as the root.- Parameters:
file- The file to write to.root- The source of the data to write to the file.- Throws:
IOException- If an I/O error occurs while writing to the file or the object structure contains data that cannot be saved.
-
write
Writes a binary plist file with the given object as the root.- Parameters:
root- The source of the data to write to the file.file- The file to write to.- Throws:
IOException- If an I/O error occurs while writing to the file or the object structure contains data that cannot be saved.
-
write
public static void write(NSObject root, File file, boolean createParentDirectories) throws IOException Writes a binary plist file with the given object as the root.- Parameters:
root- The source of the data to write to the file.file- The file to write to.createParentDirectories- If set to true, the file's parent directories will be created.- Throws:
IOException- If an I/O error occurs while writing to the file or the object structure contains data that cannot be saved.
-
write
Writes a binary plist file with the given object as the root.- Parameters:
root- The source of the data to write to the file.path- The path of the file to write to.- Throws:
IOException- If an I/O error occurs while writing to the file or the object structure contains data that cannot be saved.
-
write
Deprecated.Use the overload that takes the root as first argument and the stream as second.Writes a binary plist serialization of the given object as the root. This method does not close the output stream.- Parameters:
out- The stream to write to.root- The source of the data to write to the stream.- Throws:
IOException- If an I/O error occurs while writing to the stream or the object structure contains data that cannot be saved.
-
write
Writes a binary plist serialization of the given object as the root. This method does not close the output stream.- Parameters:
root- The source of the data to write to the stream.out- The stream to write to.- Throws:
IOException- If an I/O error occurs while writing to the stream or the object structure contains data that cannot be saved.
-
writeToArray
Writes a binary plist serialization of the given object as the root into a byte array.- Parameters:
root- The root object of the property list- Returns:
- The byte array containing the serialized property list
- Throws:
IOException- If an I/O error occurs while writing to the stream or the object structure contains data that cannot be saved.
-
write
- Throws:
IOException
-
assignID
-
getID
-
computeIdSizeInBytes
private static int computeIdSizeInBytes(int numberOfIds) -
computeOffsetSizeInBytes
private int computeOffsetSizeInBytes(long maxOffset) -
writeIntHeader
- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
writeBytes
- Throws:
IOException
-
writeID
- Throws:
IOException
-
writeLong
- Throws:
IOException
-
writeDouble
- Throws:
IOException
-