当前位置: 动力学知识库 > 问答 > 编程问答 >

Is there an enum with MIME Types in Java?

问题描述:

Possible Duplicate:

Interface/enum listing standard mime-type constants

Is there an enum (or something similar) which holds constants for the most common MIME types?

I'd like to deal with some constants rather than firing Strings here and there.

网友答案:

There is not one in the JDK that I am aware of. But there is this class that you can probably start with.

Edit:

Now there is a better option I think. Using Guava's MediaType is a class that is maintained.

网友答案:

There cannot be an enum, since there is no closed set of possible values.

Several frameworks provide convenient classes that contain list of Strings. For example JAX-RS (jsr311) spec provides a class javax.ws.rs.core.MediaType.

网友答案:

Java stores some MIME types in DataFlavor.

分享给朋友:
您可能感兴趣的文章:
随机阅读: