@@ -138,7 +138,7 @@ public class ImageUtils {
138
138
SUPPORTED_IMAGE_EXTENSIONS .addAll (Arrays .asList (ImageIO .getReaderFileSuffixes ()));
139
139
SUPPORTED_IMAGE_EXTENSIONS .add ("tec" ); // Add JFIF .tec files
140
140
SUPPORTED_IMAGE_EXTENSIONS .removeIf ("db" ::equals ); // remove db files
141
-
141
+
142
142
SUPPORTED_IMAGE_MIME_TYPES = new TreeSet <>(Arrays .asList (ImageIO .getReaderMIMETypes ()));
143
143
/*
144
144
* special cases and variants that we support, but don't get registered
@@ -213,7 +213,7 @@ public static boolean thumbnailSupported(Content content) {
213
213
* @param file the AbstractFile to test
214
214
*
215
215
* @return true if the file is an image we can read and generate thumbnail
216
- * for.
216
+ * for.
217
217
*/
218
218
public static boolean isImageThumbnailSupported (AbstractFile file ) {
219
219
return isMediaThumbnailSupported (file , "image/" , SUPPORTED_IMAGE_MIME_TYPES , SUPPORTED_IMAGE_EXTENSIONS ) || hasImageFileHeader (file );//NON-NLS
@@ -239,17 +239,16 @@ public static boolean isGIF(AbstractFile file) {
239
239
* VideoUtils both implement/extend some base interface/abstract class. That
240
240
* would be the natural place to put this.
241
241
*
242
- * @param file the AbstractFile to test
243
- * @param mimeTypePrefix a MIME 'top-level type name' such as "image/",
244
- * including the "/". In addition to the list of
245
- * supported MIME types, any type that starts with
246
- * this prefix will be regarded as supported
242
+ * @param file the AbstractFile to test
243
+ * @param mimeTypePrefix a MIME 'top-level type name' such as "image/",
244
+ * including the "/". In addition to the list of supported MIME types, any
245
+ * type that starts with this prefix will be regarded as supported
247
246
* @param supportedMimeTypes a collection of mimetypes that are supported
248
247
* @param supportedExtension a collection of extensions that are supported
249
248
*
250
249
* @return true if a thumbnail can be generated for the given file based on
251
- * the given MIME type prefix and lists of supported MIME types and
252
- * extensions
250
+ * the given MIME type prefix and lists of supported MIME types and
251
+ * extensions
253
252
*/
254
253
static boolean isMediaThumbnailSupported (AbstractFile file , String mimeTypePrefix , final Collection <String > supportedMimeTypes , final List <String > supportedExtension ) {
255
254
if (false == file .isFile () || file .getSize () <= 0 ) {
@@ -283,7 +282,7 @@ static boolean isMediaThumbnailSupported(AbstractFile file, String mimeTypePrefi
283
282
* @return a FileTypeDetector
284
283
*
285
284
* @throws FileTypeDetectorInitException if initializing the
286
- * FileTypeDetector failed.
285
+ * FileTypeDetector failed.
287
286
*/
288
287
synchronized private static FileTypeDetector getFileTypeDetector () throws FileTypeDetector .FileTypeDetectorInitException {
289
288
if (fileTypeDetector == null ) {
@@ -296,11 +295,11 @@ synchronized private static FileTypeDetector getFileTypeDetector() throws FileTy
296
295
* Get a thumbnail of a specified size for the given image. Generates the
297
296
* thumbnail if it is not already cached.
298
297
*
299
- * @param content the content to generate a thumbnail for
298
+ * @param content the content to generate a thumbnail for
300
299
* @param iconSize the size (one side of a square) in pixels to generate
301
300
*
302
301
* @return A thumbnail for the given image or a default one if there was a
303
- * problem making a thumbnail.
302
+ * problem making a thumbnail.
304
303
*/
305
304
public static BufferedImage getThumbnail (Content content , int iconSize ) {
306
305
if (content instanceof AbstractFile ) {
@@ -339,7 +338,7 @@ public static BufferedImage getThumbnail(Content content, int iconSize) {
339
338
* @param file The AbstractFile to get a stream for.
340
339
*
341
340
* @return A BufferedInputStream wrapped around a ReadContentStream for the
342
- * given AbstractFile
341
+ * given AbstractFile
343
342
*/
344
343
private static BufferedInputStream getBufferedReadContentStream (AbstractFile file ) {
345
344
return new BufferedInputStream (new ReadContentInputStream (file ));
@@ -349,11 +348,11 @@ private static BufferedInputStream getBufferedReadContentStream(AbstractFile fil
349
348
* Get a thumbnail of a specified size for the given image. Generates the
350
349
* thumbnail if it is not already cached.
351
350
*
352
- * @param content the content to generate a thumbnail for
351
+ * @param content the content to generate a thumbnail for
353
352
* @param iconSize the size (one side of a square) in pixels to generate
354
353
*
355
354
* @return File object for cached image. Is guaranteed to exist, as long as
356
- * there was not an error generating or saving the thumbnail.
355
+ * there was not an error generating or saving the thumbnail.
357
356
*/
358
357
@ Nullable
359
358
public static File getCachedThumbnailFile (Content content , int iconSize ) {
@@ -368,8 +367,8 @@ public static File getCachedThumbnailFile(Content content, int iconSize) {
368
367
* @param fileID the fileID to get the cached thumbnail location for
369
368
*
370
369
* @return A File object representing the location of the cached thumbnail.
371
- * This file may not actually exist(yet). Returns null if there was
372
- * any problem getting the file, such as no case was open.
370
+ * This file may not actually exist(yet). Returns null if there was any
371
+ * problem getting the file, such as no case was open.
373
372
*/
374
373
private static File getCachedThumbnailLocation (long fileID ) {
375
374
return cacheFileMap .computeIfAbsent (fileID , id -> {
@@ -427,7 +426,7 @@ public static boolean isJpegFileHeader(AbstractFile file) {
427
426
* @param file the AbstractFile to parse
428
427
*
429
428
* @return Offset of first Start Of Image marker, or 0 if none found. This
430
- * will let ImageIO try to open it from offset 0.
429
+ * will let ImageIO try to open it from offset 0.
431
430
*/
432
431
private static long getJfifStartOfImageOffset (AbstractFile file ) {
433
432
byte [] fileHeaderBuffer ;
@@ -507,7 +506,7 @@ private static byte[] readHeader(AbstractFile file, int buffLength) throws TskCo
507
506
* @return the width in pixels
508
507
*
509
508
* @throws IOException If the file is not a supported image or the width
510
- * could not be determined.
509
+ * could not be determined.
511
510
*/
512
511
static public int getImageWidth (AbstractFile file ) throws IOException {
513
512
return getImageProperty (file ,
@@ -524,7 +523,7 @@ static public int getImageWidth(AbstractFile file) throws IOException {
524
523
* @return the height in pixels
525
524
*
526
525
* @throws IOException If the file is not a supported image or the height
527
- * could not be determined.
526
+ * could not be determined.
528
527
*/
529
528
static public int getImageHeight (AbstractFile file ) throws IOException {
530
529
return getImageProperty (file ,
@@ -537,8 +536,8 @@ static public int getImageHeight(AbstractFile file) throws IOException {
537
536
/**
538
537
* Functional interface for methods that extract a property out of an
539
538
* ImageReader. Initially created to abstract over
540
- * {@link # getImageHeight(org.sleuthkit.datamodel.AbstractFile)} and
541
- * {@link # getImageWidth(org.sleuthkit.datamodel.AbstractFile)}
539
+ * getImageHeight(org.sleuthkit.datamodel.AbstractFile) and
540
+ * getImageWidth(org.sleuthkit.datamodel.AbstractFile)
542
541
*
543
542
* @param <T> The type of the property.
544
543
*/
@@ -553,18 +552,17 @@ private static interface PropertyExtractor<T> {
553
552
* public methods that pull particular (usually meta-)data out of a image
554
553
* file.
555
554
*
556
- * @param file the file to extract the data from
557
- * @param errorTemplate a message template used to log errors. Should
558
- * take one parameter: the file's unique path or
559
- * name.
555
+ * @param file the file to extract the data from
556
+ * @param errorTemplate a message template used to log errors. Should take
557
+ * one parameter: the file's unique path or name.
560
558
* @param propertyExtractor an implementation of {@link PropertyExtractor}
561
- * used to retrieve the specific property.
559
+ * used to retrieve the specific property.
562
560
*
563
561
* @return the the value of the property extracted by the given
564
- * propertyExtractor
562
+ * propertyExtractor
565
563
*
566
564
* @throws IOException if there was a problem reading the property from the
567
- * file.
565
+ * file.
568
566
*
569
567
* @see PropertyExtractor
570
568
* @see #getImageHeight(org.sleuthkit.datamodel.AbstractFile)
@@ -608,8 +606,8 @@ private static <T> T getImageProperty(AbstractFile file, final String errorTempl
608
606
* but is not started automatically. Clients are responsible for running the
609
607
* task, monitoring its progress, and using its result.
610
608
*
611
- * @param file The file to create a thumbnail for.
612
- * @param iconSize The size of the thumbnail.
609
+ * @param file The file to create a thumbnail for.
610
+ * @param iconSize The size of the thumbnail.
613
611
* @param defaultOnFailure Whether or not to default on failure.
614
612
*
615
613
* @return a new Task that returns a thumbnail as its result.
@@ -978,10 +976,10 @@ public static File getFile(long id) {
978
976
* @param iconSize
979
977
*
980
978
* @return a thumbnail for the given image or a default one if there was a
981
- * problem making a thumbnail.
979
+ * problem making a thumbnail.
982
980
*
983
- * @deprecated use {@link # getThumbnail(org.sleuthkit.datamodel.Content, int)
984
- * } instead.
981
+ * @deprecated use getThumbnail(org.sleuthkit.datamodel.Content, int)
982
+ * instead.
985
983
*/
986
984
@ Nonnull
987
985
@ Deprecated
@@ -997,10 +995,10 @@ public static BufferedImage getIcon(Content content, int iconSize) {
997
995
* @param iconSize
998
996
*
999
997
* @return File object for cached image. Is guaranteed to exist, as long as
1000
- * there was not an error generating or saving the thumbnail.
998
+ * there was not an error generating or saving the thumbnail.
1001
999
*
1002
- * @deprecated use {@link # getCachedThumbnailFile(org.sleuthkit.datamodel.Content, int)
1003
- * } instead.
1000
+ * @deprecated use getCachedThumbnailFile(org.sleuthkit.datamodel.Content,
1001
+ * int) instead.
1004
1002
*
1005
1003
*/
1006
1004
@ Nullable
0 commit comments