BrightSide Workbench Full Report + Source Code
ContentStream.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2020 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
package
org.turro.elephant.download;
20
21
import
java.io.File;
22
import
java.io.FileInputStream;
23
import
java.io.FileNotFoundException;
24
import
java.io.InputStream;
25
30
public
class
ContentStream
{
31
32
private
final
File file;
33
private
final
String fileName;
34
private
final
long
fileSize;
35
36
public
ContentStream
(File file) {
37
this.file = file;
38
this.fileName = file.getName();
39
this.fileSize = file.length();
40
}
41
42
public
ContentStream
(String fileName,
long
fileSize) {
43
this.file =
null
;
44
this.fileName = fileName;
45
this.fileSize = fileSize;
46
}
47
48
public
String
getAbsolutePath
() {
49
return
file.getAbsolutePath();
50
}
51
52
public
String
getFileName
() {
53
return
fileName;
54
}
55
56
public
long
getFileSize
() {
57
return
fileSize;
58
}
59
60
public
InputStream
getInputStream
() throws FileNotFoundException {
61
if
(file !=
null
) {
62
return
new
FileInputStream(file);
63
}
else
{
64
return
doInputStream
();
65
}
66
}
67
68
protected
InputStream
doInputStream
() {
69
throw
new
UnsupportedOperationException(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
70
}
71
72
}
org.turro.elephant.download.ContentStream
Definition:
ContentStream.java:30
org.turro.elephant.download.ContentStream.getInputStream
InputStream getInputStream()
Definition:
ContentStream.java:60
org.turro.elephant.download.ContentStream.getFileSize
long getFileSize()
Definition:
ContentStream.java:56
org.turro.elephant.download.ContentStream.getFileName
String getFileName()
Definition:
ContentStream.java:52
org.turro.elephant.download.ContentStream.doInputStream
InputStream doInputStream()
Definition:
ContentStream.java:68
org.turro.elephant.download.ContentStream.ContentStream
ContentStream(File file)
Definition:
ContentStream.java:36
org.turro.elephant.download.ContentStream.ContentStream
ContentStream(String fileName, long fileSize)
Definition:
ContentStream.java:42
org.turro.elephant.download.ContentStream.getAbsolutePath
String getAbsolutePath()
Definition:
ContentStream.java:48
TurroProjects
Public
Elephant
elephant
src
main
java
org
turro
elephant
download
ContentStream.java
Generated on Tue Mar 12 2024 07:01:18 for BrightSide by
1.9.1