1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/**
* Set the PictureInfo properties
*/
public void setPictureInfo()
{
this.type = getFileType ();
switch (this.type)
{
case DIRECTORY:
this.ParentDirName = file.getParent();
this.Length = getFileSize ();
this.TypName = "directory";
break;
case GIF_PICTURE:
long gifLength = getFileSize ();
int [] gifSize = getGIFSize ();
if (gifSize != null)
{
this.TypName = "GIF-Image";
this.Length = gifLength;
this.Size = gifSize;
this.compression = (gifLength * 100 / (gifSize [0] * gifSize [1]));
this.state = true;
}
break;
case JPEG_PICTURE:
long jpegLength = getFileSize ();
java.awt.Dimension jpegSize = getJPEGSize ();
if (jpegSize != null)
{
this.TypName = "JPEG-Image";
this.Length = jpegLength;
this.Size = new int[2];
this.Size[0] = jpegSize.width;
this.Size[1] = jpegSize.height;
this.compression = (jpegLength * 100 / (jpegSize.width * jpegSize.height * 3));
this.state = true;
}
break;
default:
this.TypName = "unknown";
this.state = false;
break;
}
} |
Partager