Package com.iizix.license
Class ProfilePicture
java.lang.Object
com.iizix.license.ProfilePicture
- All Implemented Interfaces:
- Serializable,- Cloneable
Class for profile picture.
- Author:
- Christopher Mindus
- See Also:
- Constructor SummaryConstructorsConstructorDescription- ProfilePicture- (File file) Constructs the profile picture from a file, assuming it is the "DETAIL_UploadedProfileImage" file.- ProfilePicture- (File file, String type) Constructs the profile picture from a file, assuming it is the "DETAIL_UploadedProfileImage" file.- ProfilePicture- (String type, String name, byte[] data) Constructor of the file when only data and type and filename is present.
- Method SummaryModifier and TypeMethodDescription- clone()Clones the instance.- booleanCleans up any temporary files or directories created.- booleanChecks if equal with another.- protected void- finalize()Finalized: delete temporaries.- getFile()Gets the file for the profile image.Gets the file for the profile image.- intGets the size of the image byte data.Gets the image extension without ".".Gets the image array as an input stream.- getName()Returns the (file) name of the profile picture.- getType()Gets the profile image details type string.- int- hashCode()Hash code of the instance.- toString()A string representation.
- Constructor Details- ProfilePictureConstructs the profile picture from a file, assuming it is the "DETAIL_UploadedProfileImage" file.- Parameters:
- file- The profile picture.
- Throws:
- IOException- If the file data cannot be loaded, the size is too large, the file extension is not ".png", ".jpg" or ".jpeg".
 
- ProfilePictureConstructs the profile picture from a file, assuming it is the "DETAIL_UploadedProfileImage" file.- Parameters:
- file- The profile picture.
- type- The image type for database details:- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage,- IBasicUserInfoDetailNames.DETAIL_LargeProfileImage; or- IBasicUserInfoDetailNames.DETAIL_ThumbnailProfileImage.
- Throws:
- IOException- If the file data cannot be loaded, the size is too large (larger than 1 MB), the file extension is not ".png", ".jpg" or ".jpeg".
- IllegalArgumentException- If- typeis not- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImageor- null,- IBasicUserInfoDetailNames.DETAIL_LargeProfileImage; or- IBasicUserInfoDetailNames.DETAIL_ThumbnailProfileImage.
 
- ProfilePictureConstructor of the file when only data and type and filename is present.- Parameters:
- type- The type.
- name- The file name of the profile picture.
- data- The byte data of the file.
- Throws:
- IllegalArgumentException- If- typeis not- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImageor- null,- IBasicUserInfoDetailNames.DETAIL_LargeProfileImage; or- IBasicUserInfoDetailNames.DETAIL_ThumbnailProfileImage.
 
 
- Method Details- cloneClones the instance.
- getTypeGets the profile image details type string.
- getNameReturns the (file) name of the profile picture.- Returns:
- The (file) name, without path.
 
- getImageInputStreamGets the image array as an input stream.- Returns:
- Image input stream.
 
- getImageDataSizepublic int getImageDataSize()Gets the size of the image byte data.- Returns:
- The byte count of the image data, i.e. the file size on disk in bytes.
 
- getImageExtensionGets the image extension without ".".- Returns:
- The image extension, "png" or "jpg".
 
- deleteTemporariespublic boolean deleteTemporaries()Cleans up any temporary files or directories created. If this method is called and there are temporary file(s), nothing will be performed.- Errors during deleting of files is logged. - Returns:
- true if temporary file(s) where deleted.
 
- getFileGets the file for the profile image.- If this method is called with previous temporary files and/or directories, those are deleted prior to returning, depending on the - isTemporaryflag.- Parameters:
- dir- Directory where to place the temporary file. If the- dirparameter is- nullthen a temporary directory will be created and the profile picture file placed inside. The creation of the temporary file and/or directory is only done once.
- isTemporary- If the file that is created should be considered as temporary or not. If not temporary, the created file (if created) will not be deleted.
- Returns:
- file The file, a potentially temporary file when created depending on the isTemporaryparameter.Use the method deleteTemporaries()to clean-up.
- Throws:
- IOException- For I/O errors.
 
- getFileGets the file for the profile image.- If this method is called with previous temporary files and/or directories, those are deleted prior to returning. - Returns:
- file A temporary file created.Use the method deleteTemporaries()to clean-up.
- Throws:
- IOException- For I/O errors.
 
- toStringA string representation.
- equalsChecks if equal with another.
- hashCodepublic int hashCode()Hash code of the instance.
- finalizeFinalized: delete temporaries.