- Author
- Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Definition at line 45 of file FileWrapper.java.
◆ FileWrapper()
org.turro.file.FileWrapper.FileWrapper |
( |
File |
file | ) |
|
Definition at line 52 of file FileWrapper.java.
57 if(
file.isDirectory()) {
59 }
else if(
file.isFile()) {
List< FileAction > actions
static boolean fits(File file)
◆ copyTo()
void org.turro.file.FileWrapper.copyTo |
( |
File |
destination | ) |
throws IOException |
Definition at line 111 of file FileWrapper.java.
112 if(destination.isDirectory()) {
113 if(
file.isDirectory()) {
114 FileUtil.copyFolder(
file, destination.getAbsolutePath());
115 }
else if(
file.isFile()) {
116 FileUtil.copyFile(
file, destination.getAbsolutePath());
◆ delete()
void org.turro.file.FileWrapper.delete |
( |
| ) |
|
◆ download()
void org.turro.file.FileWrapper.download |
( |
| ) |
|
Definition at line 121 of file FileWrapper.java.
123 Filedownload.save(
file, ContentTypes.getContentType(FileUtil.getExtension(
file)));
126 .entityName(
file.getName()).comment(
"downloaded")
128 }
catch (Exception ex) {
static String getRelativePath(String path)
static String logMsg(String msg)
◆ getAction()
FileAction org.turro.file.FileWrapper.getAction |
( |
String |
label | ) |
|
Definition at line 83 of file FileWrapper.java.
85 if(fa.getLabel().equals(label)) {
List< FileAction > getActions()
◆ getActions()
List<FileAction> org.turro.file.FileWrapper.getActions |
( |
| ) |
|
◆ getBaseName()
String org.turro.file.FileWrapper.getBaseName |
( |
| ) |
|
◆ getExtension()
String org.turro.file.FileWrapper.getExtension |
( |
| ) |
|
◆ getFile()
File org.turro.file.FileWrapper.getFile |
( |
| ) |
|
◆ getFileByType()
static FileWrapper org.turro.file.FileWrapper.getFileByType |
( |
File |
file | ) |
|
|
static |
Definition at line 186 of file FileWrapper.java.
191 }
else if(VideoFile.isMyType(
file)) {
192 return new VideoFile(
file);
193 }
else if(ImageFile.isMyType(
file)) {
194 return new ImageFile(
file);
197 }
else if(DefaultFile.isMyType(
file)) {
198 return new DefaultFile(
file);
static boolean isMyType(File file)
static boolean isMyType(File file)
static boolean isMyType(File file)
◆ getFileItem()
FileItem org.turro.file.FileWrapper.getFileItem |
( |
| ) |
|
◆ getProperties()
Properties org.turro.file.FileWrapper.getProperties |
( |
| ) |
throws FileNotFoundException, IOException |
Definition at line 92 of file FileWrapper.java.
PropertiesFile propertiesFile
Properties getProperties()
◆ setFileItem()
void org.turro.file.FileWrapper.setFileItem |
( |
FileItem |
fileItem | ) |
|
◆ upload()
void org.turro.file.FileWrapper.upload |
( |
final Command |
command | ) |
|
Definition at line 133 of file FileWrapper.java.
137 Fileupload.get(100,
new EventListener<UploadEvent>() {
139 public void onEvent(UploadEvent event) {
140 ArrayList<File> list =
new ArrayList<>();
141 Media[] medias =
event.getMedias();
142 if(medias ==
null || medias.length == 0)
return;
143 for(Media media : medias) {
144 File newFile =
new File(
file.getAbsolutePath() +
"/" + Document.correctName(media.getName()));
145 Medias.toFile(media, newFile);
148 if(command !=
null) {
150 Context context =
new Context();
151 context.put(
"files", list);
152 command.execute(context);
153 }
catch (Exception ex) {
◆ uploadContent()
void org.turro.file.FileWrapper.uploadContent |
( |
final Command |
command | ) |
|
Definition at line 161 of file FileWrapper.java.
162 if(!
file.getParentFile().exists()) {
163 file.getParentFile().mkdirs();
165 Fileupload.get(1,
new EventListener<UploadEvent>() {
167 public void onEvent(UploadEvent event)
throws Exception {
168 Media[] medias =
event.getMedias();
169 if(medias ==
null || medias.length == 0)
return;
170 for(Media media : medias) {
171 Medias.toFile(media,
file);
173 if(command !=
null) {
175 Context context =
new Context();
176 context.put(
"file",
file);
177 command.execute(context);
178 }
catch (Exception ex) {
◆ actions
List<FileAction> org.turro.file.FileWrapper.actions |
|
protected |
◆ file
File org.turro.file.FileWrapper.file |
|
protected |
◆ fileItem
FileItem org.turro.file.FileWrapper.fileItem |
|
protected |
◆ propertiesFile
The documentation for this class was generated from the following file: