org.apache.sling.fileoptim

## Class OptimizationResult

- java.lang.Object
- - org.apache.sling.fileoptim.OptimizationResult

    @ProviderType
    public class OptimizationResult
    extends Object

Result of file optimization

### Constructor Summary

Constructors
Constructor and Description
`OptimizationResult(org.apache.sling.api.resource.Resource resource)`

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `getAlgorithm()` Returns the algorithm by which the file was optimized
`byte[]` `getOptimizedContents()` Returns the raw optimized contents as a byte array
`InputStream` `getOptimizedContentStream()` Returns the optimized contents as an InputStream
`long` `getOptimizedSize()` Returns the optimized size in bytes
`long` `getOriginalSize()` Return the original size in bytes
`org.apache.sling.api.resource.Resource` `getResource()` Returns the resource that was optimized
`double` `getSavings()` Return the percent savings as a 1-based double value
`boolean` `isOptimized()` Returns true if the result is actually optimized, if the optimization did not provide a smaller result or the file was not optimized for any other reason, this will be false.
`void` `setAlgorithm(String algorithm)`
`void` `setOptimized(boolean optimized)`
`void` `setOptimizedContents(byte[] optimizedContents)`
`void` `setOptimizedSize(long optimizedSize)`
`void` `setOriginalSize(long originalSize)`
`void` `setSavings(double savings)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### OptimizationResult

    public OptimizationResult(org.apache.sling.api.resource.Resource resource)

### Method Detail

#### getAlgorithm

    public String getAlgorithm()

Returns the algorithm by which the file was optimized

Returns:
  the algorithm

#### getOptimizedContents

    public byte[] getOptimizedContents()

Returns the raw optimized contents as a byte array

Returns:
  the optimized contents

#### getOptimizedContentStream

    public InputStream getOptimizedContentStream()

Returns the optimized contents as an InputStream

Returns:
  the optimized content stream

#### getOptimizedSize

    public long getOptimizedSize()

Returns the optimized size in bytes

Returns:
  the optimizedSize

#### getOriginalSize

    public long getOriginalSize()

Return the original size in bytes

Returns:
  the originalSize

#### getResource

    public org.apache.sling.api.resource.Resource getResource()

Returns the resource that was optimized

Returns:
  the resource

#### getSavings

    public double getSavings()

Return the percent savings as a 1-based double value

Returns:
  the savings

#### isOptimized

    public boolean isOptimized()

Returns true if the result is actually optimized, if the optimization did not provide a smaller result or the file was not optimized for any other reason, this will be false.

Returns:
  the optimized flag

#### setAlgorithm

    public void setAlgorithm(String algorithm)

Parameters:
  `algorithm` - the algorithm to set

#### setOptimized

    public void setOptimized(boolean optimized)

Parameters:
  `optimized` - the optimized to set

#### setOptimizedContents

    public void setOptimizedContents(byte[] optimizedContents)

#### setOptimizedSize

    public void setOptimizedSize(long optimizedSize)

Parameters:
  `optimizedSize` - the optimizedSize to set

#### setOriginalSize

    public void setOriginalSize(long originalSize)

Parameters:
  `originalSize` - the originalSize to set

#### setSavings

    public void setSavings(double savings)

Parameters:
  `savings` - the savings to set