我有一个可以通过各种方法和各种格式接收数据的应用程序。我有可插入的接收器,它们以某种方式获取数据(例如,通过轮询邮箱、侦听 HTTP 请求、查看目录的内容等),将其与 MIME 类型相关联,然后像这样传递它:
public class Transmission {
private String origin; // where the data came from
private String destination; // where the data was sent to
private String mime; // the MIME type of the data
private BLOB data; // this is what I need an appropriate type for
}
再往下,数据由专门的处理程序根据mime
字段的值进行处理。我期待 ZIP 文件、Excel 文档、SOAP、通用 XML、纯文本等内容。此时,代码应该与数据中的内容无关。data
该字段的合适类型是什么?Object
? InputStream
? Byte[]
?