- java.lang.Object
-
- de.bernd_michaely.x3f.types.X3fData
-
- All Implemented Interfaces:
FovData
public class X3fData extends Object implements FovData
Class for representing the data and metadata contained in FOVb data (X3F files). This implementation is based on a specification which describes the file format up to "2.2". According to the documented version numbering scheme, all files of version "2.x" should work. The versions of successfully tested files include "2.1", "2.2" and "2.3". There is also some support for version "4.0".
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
parsedSuccessfully
protected boolean
validX3fData
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getDataSize()
Returns the size of the data source in bytes.long
getDirectoryPointerLocation()
Returns the file offset in bytes from the beginning of the file where the FOV[b|i] directory pointer is located or -1, if it could not be found.long
getDirectoryPointerValue()
Returns the value of the FOV[b|i] directory pointer.X3fImageData
getFullSizePreviewImage()
Returns an X3F embedded full size preview JPG image.protected X3fImageData
getLargestEmbeddedImage()
Utility method to return the largest of all embedded processed for preview images.X3fImageData[]
getListX3fImageData()
Returns a list of contained images.long
getOffsetEmbedded()
Returns the embedded offset passed in the constructor.protected X3fImageData
getSmallestEmbeddedImage()
Utility method to return the smallest of all embedded processed for preview images.X3fDirectory
getX3fDirectory()
Returns an object containing the X3F directory information.X3fHeader
getX3fHeader()
Returns an object containing the X3F header information.X3fHeader_2_1
getX3fHeader_2_1()
Convenience method: if the X3F header is an X3fHeader_2_1 instance, return it as such, otherwise null.X3fHeader_2_x
getX3fHeader_2_x()
Convenience method: if the X3F header is an X3fHeader_2_x instance, return it as such, otherwise null.X3fHeader_3_x
getX3fHeader_3_x()
Convenience method: if the X3F header is an X3fHeader_3_x instance, return it as such, otherwise null.X3fHeader_4_x
getX3fHeader_4_x()
Convenience method: if the X3F header is an X3fHeader_4_x instance, return it as such, otherwise null.X3fPropertyList
getX3fPropertyList()
Returns an object containing the X3F property list.X3fImageData
getX3fThumbnail()
Returns an X3F embedded thumbnail image.boolean
isHavingX3fHeader_2_1()
Convenience method: returns true, if the data contains a version 2 extended header.boolean
isHavingX3fHeader_2_x()
Convenience method: returns true, if the data contains a header with major revision 2.boolean
isHavingX3fHeader_3_x()
Convenience method: returns true, if the data contains a header with major revision 3.boolean
isHavingX3fHeader_4_x()
Convenience method: returns true, if the data contains a header with major revision 4.boolean
isParsedSuccessfully()
Returns true, if the parser could read the FOV[b|i] data without problems.boolean
isRecoverable()
Returns true, if a possibly corrupted file is recoverable.boolean
isRecoveryMode()
Returns true, if a recovery parser was used, and not the standard parser.boolean
isTrimmable()
Returns true, if an intact file with unnecessary data appended at the end can be trimmed to have a valid X3F directory pointer at the end of file.boolean
isValidX3fData()
Returns true, if the data has a valid X3F identifier.
-
-
-
Constructor Detail
-
X3fData
protected X3fData()
Protected constructor. Instances of this class are not to be created directly, but will be created by a parser.
-
X3fData
protected X3fData(long offsetEmbedded)
Protected constructor. Instances of this class are not to be created directly, but will be created by a parser.- Parameters:
offsetEmbedded
- externally given offset when this data is embedded
-
-
Method Detail
-
isParsedSuccessfully
public boolean isParsedSuccessfully()
Description copied from interface:FovData
Returns true, if the parser could read the FOV[b|i] data without problems. That is, the FOV[b|i] header and FOV[b|i] directory could be parsed according to the specification without an error occuring.- Specified by:
isParsedSuccessfully
in interfaceFovData
- Returns:
- true, if the parser could read the FOV[b|i] data successfully
-
isRecoveryMode
public boolean isRecoveryMode()
Description copied from interface:FovData
Returns true, if a recovery parser was used, and not the standard parser.- Specified by:
isRecoveryMode
in interfaceFovData
- Returns:
- true, if a recovery parser was used
-
isValidX3fData
public boolean isValidX3fData()
Returns true, if the data has a valid X3F identifier. That is, the first 4 bytes of the data contain "FOVb".- Returns:
- true, if the data has a valid X3F identifier
-
isRecoverable
public boolean isRecoverable()
Description copied from interface:FovData
Returns true, if a possibly corrupted file is recoverable.- Specified by:
isRecoverable
in interfaceFovData
- Returns:
- true, if a possibly corrupted file is recoverable
-
isTrimmable
public boolean isTrimmable()
Returns true, if an intact file with unnecessary data appended at the end can be trimmed to have a valid X3F directory pointer at the end of file.- Returns:
- true, if file can be trimmed to have a valid X3F directory pointer
-
getX3fHeader
public X3fHeader getX3fHeader()
Returns an object containing the X3F header information. The instance returned can be aX3fHeader_2_x
orX3fHeader_2_1
object. It can also be null, if the data is no valid X3F data.- Returns:
- an object containing X3F header information or null
-
getDataSize
public long getDataSize()
Description copied from interface:FovData
Returns the size of the data source in bytes. If this data structure is created by a recovery parser, and the full FOV[b|i] data is present plus some unneccessary data appended, this value will indicate the size of the FOV[b|i] data. That is it may e.g. be smaller than the size of the file it is read from. In case of an error -1 might be returned.- Specified by:
getDataSize
in interfaceFovData
- Returns:
- the size of the FOV[b|i] data in bytes
-
getDirectoryPointerLocation
public long getDirectoryPointerLocation()
Description copied from interface:FovData
Returns the file offset in bytes from the beginning of the file where the FOV[b|i] directory pointer is located or -1, if it could not be found.- Specified by:
getDirectoryPointerLocation
in interfaceFovData
- Returns:
- the file offset where the FOV[b|i] directory pointer is located
-
getDirectoryPointerValue
public long getDirectoryPointerValue()
Description copied from interface:FovData
Returns the value of the FOV[b|i] directory pointer. That is the offset in bytes from the beginning of the file of the FOV[b|i] directory section.- Specified by:
getDirectoryPointerValue
in interfaceFovData
- Returns:
- the value of the FOV[b|i] directory pointer
-
getX3fDirectory
public X3fDirectory getX3fDirectory()
Returns an object containing the X3F directory information.- Returns:
- an object containing the X3F directory information
-
getX3fPropertyList
public X3fPropertyList getX3fPropertyList()
Returns an object containing the X3F property list.- Returns:
- an object containing the X3F property list
-
getListX3fImageData
public X3fImageData[] getListX3fImageData()
Returns a list of contained images.- Returns:
- a list of contained images
-
isHavingX3fHeader_4_x
public boolean isHavingX3fHeader_4_x()
Convenience method: returns true, if the data contains a header with major revision 4.- Returns:
- true, if the data contains a version 4 header
-
isHavingX3fHeader_3_x
public boolean isHavingX3fHeader_3_x()
Convenience method: returns true, if the data contains a header with major revision 3.- Returns:
- true, if the data contains a version 3 header
-
isHavingX3fHeader_2_x
public boolean isHavingX3fHeader_2_x()
Convenience method: returns true, if the data contains a header with major revision 2.- Returns:
- true, if the data contains a standard header
-
isHavingX3fHeader_2_1
public boolean isHavingX3fHeader_2_1()
Convenience method: returns true, if the data contains a version 2 extended header.- Returns:
- true, if the header is an extended header
-
getX3fHeader_4_x
public X3fHeader_4_x getX3fHeader_4_x()
Convenience method: if the X3F header is an X3fHeader_4_x instance, return it as such, otherwise null.- Returns:
- an X3fHeader_4_x instance or null
-
getX3fHeader_3_x
public X3fHeader_3_x getX3fHeader_3_x()
Convenience method: if the X3F header is an X3fHeader_3_x instance, return it as such, otherwise null.- Returns:
- an X3fHeader_3_x instance or null
-
getX3fHeader_2_x
public X3fHeader_2_x getX3fHeader_2_x()
Convenience method: if the X3F header is an X3fHeader_2_x instance, return it as such, otherwise null.- Returns:
- an X3fHeader_2_x instance or null
-
getX3fHeader_2_1
public X3fHeader_2_1 getX3fHeader_2_1()
Convenience method: if the X3F header is an X3fHeader_2_1 instance, return it as such, otherwise null.- Returns:
- an X3fHeader_2_1 instance or null
-
getLargestEmbeddedImage
protected X3fImageData getLargestEmbeddedImage()
Utility method to return the largest of all embedded processed for preview images.- Returns:
- the largest of all embedded processed for preview images or null, if none exists
-
getSmallestEmbeddedImage
protected X3fImageData getSmallestEmbeddedImage()
Utility method to return the smallest of all embedded processed for preview images.- Returns:
- the smallest of all embedded processed for preview images or null, if none exists
-
getFullSizePreviewImage
public X3fImageData getFullSizePreviewImage()
Returns an X3F embedded full size preview JPG image.- Returns:
- an embedded full size image, if present, null otherwise
-
getX3fThumbnail
public X3fImageData getX3fThumbnail()
Returns an X3F embedded thumbnail image. Note, that this does not extract a thumbnail contained in a full size JPG file.- Returns:
- an X3F embedded thumbnail image
-
getOffsetEmbedded
public long getOffsetEmbedded()
Returns the embedded offset passed in the constructor.- Returns:
- the embedded offset passed in the constructor
-
-