|
static void | toFolder (Media media, Folder folder) |
|
static void | toFolder (Media media, Folder folder, Consumer< File > consumer) |
|
static void | toFolder (Media media, File folder) |
|
static void | toFolder (Media media, File folder, Consumer< File > consumer) |
|
static void | toFile (Media media, File file) |
|
static void | toFile (Media media, File file, Consumer< File > consumer) |
|
static Reader | toReader (Media media) |
|
static InputStream | toStream (Media media) |
|
static Consumer< File > | scaling (double scale) |
|
static Consumer< File > | smart (double width, double height) |
|
static Consumer< File > | standard () |
|
static Function< File, Boolean > | smaller (long size) |
|
|
static final long | MAX_FILE_SIZE = BytesFormatter.parseBytes("16MB") |
|
- Author
- Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Definition at line 46 of file Medias.java.
◆ scaling()
static Consumer<File> org.turro.upload.Medias.scaling |
( |
double |
scale | ) |
|
|
static |
Definition at line 102 of file Medias.java.
105 ImageUtil.scale(file, file, scale);
106 }
catch (IOException ex) {
107 Toasts.message(I_.get(
"Bad format image")).show();
109 Logger.getLogger(Medias.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ smaller()
static Function<File, Boolean> org.turro.upload.Medias.smaller |
( |
long |
size | ) |
|
|
static |
Definition at line 142 of file Medias.java.
144 if(file.length() > size) {
145 Toasts.message(I_.get(
"File is too large")).show();
◆ smart()
static Consumer<File> org.turro.upload.Medias.smart |
( |
double |
width, |
|
|
double |
height |
|
) |
| |
|
static |
Definition at line 114 of file Medias.java.
117 ImageUtil.smart(file, file, width, height);
118 }
catch (IOException ex) {
119 Toasts.message(I_.get(
"Bad format image")).show();
121 Logger.getLogger(Medias.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ standard()
static Consumer<File> org.turro.upload.Medias.standard |
( |
| ) |
|
|
static |
Definition at line 126 of file Medias.java.
128 if(Document.from(file).isImage()) {
130 ImageUtil.scale(file, file, 1200);
131 }
catch (IOException ex) {
132 Toasts.message(I_.get(
"Bad format image")).show();
134 Logger.getLogger(Medias.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ toFile() [1/2]
static void org.turro.upload.Medias.toFile |
( |
Media |
media, |
|
|
File |
file |
|
) |
| |
|
static |
◆ toFile() [2/2]
static void org.turro.upload.Medias.toFile |
( |
Media |
media, |
|
|
File |
file, |
|
|
Consumer< File > |
consumer |
|
) |
| |
|
static |
Definition at line 70 of file Medias.java.
71 try(FileOutputStream fos =
new FileOutputStream(file)) {
72 if(media.inMemory()) {
73 fos.write(media.isBinary() ? media.getByteData() : media.getStringData().getBytes());
75 byte[] buffer =
new byte[102400];
76 try(InputStream is =
toStream(media)) {
78 while((r = is.read(buffer)) != -1) {
79 fos.write(buffer, 0, r);
83 }
catch (IOException ex) {
84 Logger.getLogger(RepositoryContent.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
86 if(file.exists() && consumer !=
null) {
87 consumer.accept(file);
◆ toFolder() [1/4]
static void org.turro.upload.Medias.toFolder |
( |
Media |
media, |
|
|
File |
folder |
|
) |
| |
|
static |
◆ toFolder() [2/4]
static void org.turro.upload.Medias.toFolder |
( |
Media |
media, |
|
|
File |
folder, |
|
|
Consumer< File > |
consumer |
|
) |
| |
|
static |
Definition at line 62 of file Medias.java.
63 toFile(media, Folder.from(folder).ensure().path().resolve(Document.correctName(media.getName())).toFile(), consumer);
◆ toFolder() [3/4]
static void org.turro.upload.Medias.toFolder |
( |
Media |
media, |
|
|
Folder |
folder |
|
) |
| |
|
static |
◆ toFolder() [4/4]
static void org.turro.upload.Medias.toFolder |
( |
Media |
media, |
|
|
Folder |
folder, |
|
|
Consumer< File > |
consumer |
|
) |
| |
|
static |
◆ toReader()
static Reader org.turro.upload.Medias.toReader |
( |
Media |
media | ) |
|
|
static |
Definition at line 91 of file Medias.java.
92 if(!media.isBinary()) {
93 return media.getReaderData();
◆ toStream()
static InputStream org.turro.upload.Medias.toStream |
( |
Media |
media | ) |
|
|
static |
Definition at line 98 of file Medias.java.
99 return media.isBinary() ? media.getStreamData() :
new ReaderInputStream(media.getReaderData(), Charset.defaultCharset());
◆ MAX_FILE_SIZE
final long org.turro.upload.Medias.MAX_FILE_SIZE = BytesFormatter.parseBytes("16MB") |
|
static |
The documentation for this class was generated from the following file: