Package com.exedio.cope.pattern
Class MediaType
java.lang.Object
com.exedio.cope.pattern.MediaType
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic MediaTypeforFileName(String fileName) static MediaTypeforMagic(byte[] magic) Deprecated.static MediaTypeDeprecated.UseforMagics(File)instead.forMagics(byte[] magic) static MediaTypestatic MediaTypeforNameAndAliases(String name) getAllowed(Media media) Returns the typical file extension for this media type.Deprecated.There are multiple extensions now.Returns a list of file extensions for this media type.getName()booleanhasMagic()static inttoString()
-
Field Details
-
JPEG
- See Also:
-
PNG
- See Also:
-
GIF
- See Also:
-
WEBP
- See Also:
-
TIFF
- See Also:
-
ICON
- See Also:
-
SVG
- See Also:
-
ZIP
- See Also:
-
JAR
- See Also:
-
PDF
- See Also:
-
JAVASCRIPT
- See Also:
-
EOT
- See Also:
-
WOFF
- See Also:
-
WOFF2
- See Also:
-
TTF
- See Also:
-
DOCX
- See Also:
-
XLSX
- See Also:
-
-
Method Details
-
hasMagic
public boolean hasMagic() -
getExtensions
Returns a list of file extensions for this media type. The most common is used assign to index 0. The result does include the leading dot, for example ".jpg". -
getDefaultExtension
Returns the typical file extension for this media type. The result does include the leading dot, for example ".jpg". -
getExtension
Deprecated.There are multiple extensions now. Please usegetDefaultExtension()orgetExtensions(). -
getName
-
getAliases
-
getAllowed
-
toString
-
magicMaxLength
public static int magicMaxLength() -
forFileName
- Parameters:
fileName- the file name where to look for the extension
-
forName
-
forNameAndAliases
-
forMagics
- Parameters:
magic- must contain at least the firstmagicMaxLength()bytes of the file and must not be empty.
-
forMagics
- Throws:
IOException
-
forMagics
- Throws:
IOException
-
forMagic
Deprecated.UseforMagics(byte[])instead. -
forMagic
Deprecated.UseforMagics(File)instead.- Throws:
IOException
-
forMagics(byte[])instead.