接口的方法能不能少一点?简单点?

某个接口的设计

FileConnector 

public void saveFile(String uploadPath, File[] files)
   throws FileNotFoundException;

为什么是File[]?很奇怪,考虑复杂业务是不是太多了?实现类受得了这么折腾吗?

 

 //XXX: 能否就指定文件的path?
 public void saveFile(String uploadPath, String fileName,
   InputStream inputStream) throws FileNotFoundException;

 

最后改成:

 <T> T read(InputStreamReader<T> reader) throws IOException;

 void write(OutputStreamWriter writer) throws IOException;

 

posted on 2011-11-30 16:23  白乔  阅读(94)  评论(0编辑  收藏  举报

导航