| 1 | |
package org.webslinger.ext.image; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
|
| 5 | |
import org.apache.commons.vfs.FileObject; |
| 6 | |
|
| 7 | |
public class CommonsVfsImageDescriptor extends AbstractImageDescriptor { |
| 8 | |
private final FileObject file; |
| 9 | |
|
| 10 | 0 | public CommonsVfsImageDescriptor(FileObject file) { |
| 11 | 0 | this.file = file; |
| 12 | 0 | } |
| 13 | |
|
| 14 | |
public String getContentEncoding() throws IOException { |
| 15 | 0 | return file.getContent().getContentInfo().getContentEncoding(); |
| 16 | |
} |
| 17 | |
|
| 18 | |
public String getContentType() throws IOException { |
| 19 | 0 | return file.getContent().getContentInfo().getContentType(); |
| 20 | |
} |
| 21 | |
|
| 22 | |
public FileObject getFile() throws IOException { |
| 23 | 0 | return file; |
| 24 | |
} |
| 25 | |
|
| 26 | |
protected Object get(String name) throws IOException { |
| 27 | 0 | return file.getContent().getAttribute(name); |
| 28 | |
} |
| 29 | |
|
| 30 | |
public int hashCode() { |
| 31 | 0 | return file.hashCode(); |
| 32 | |
} |
| 33 | |
|
| 34 | |
public boolean equals(Object o) { |
| 35 | 0 | if (!(o instanceof CommonsVfsImageDescriptor)) return false; |
| 36 | 0 | return file.equals(((CommonsVfsImageDescriptor) o).file); |
| 37 | |
} |
| 38 | |
} |