DAMAssetPartSource.java
1.41 KB
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
49
50
51
52
53
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.dam.api.Asset
* com.day.cq.dam.api.Rendition
* org.apache.commons.httpclient.methods.multipart.PartSource
*/
package com.day.cq.dam.scene7.impl;
import com.day.cq.dam.api.Asset;
import com.day.cq.dam.api.Rendition;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.httpclient.methods.multipart.PartSource;
public class DAMAssetPartSource
implements PartSource {
private Asset damAsset;
private Rendition originalRendition;
public DAMAssetPartSource(Asset damAsset) {
this.damAsset = damAsset;
if (this.damAsset != null) {
this.originalRendition = this.damAsset.getOriginal();
}
}
public long getLength() {
long assetSize = 0;
if (this.originalRendition != null) {
assetSize = this.originalRendition.getSize();
}
return assetSize;
}
public String getFileName() {
String assetName = "";
if (this.damAsset != null) {
assetName = this.damAsset.getName();
}
return assetName;
}
public InputStream createInputStream() throws IOException {
InputStream assetInputStream = null;
if (this.originalRendition != null) {
assetInputStream = this.originalRendition.getStream();
}
return assetInputStream;
}
}