Project

General

Profile

« Previous | Next » 

Revision ec97a876

Added by Niels Hoffmann over 13 years ago

ImageMetadata is now using UriUtils

View differences:

cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/mediaMetaData/ImageMetaData.java
17 17
import java.net.URLConnection;
18 18
import java.util.HashMap;
19 19

  
20
import org.apache.http.HttpException;
20 21
import org.apache.log4j.Logger;
21 22
import org.apache.sanselan.ImageInfo;
22 23
import org.apache.sanselan.ImageReadException;
......
24 25
import org.apache.sanselan.common.IImageMetadata;
25 26
import org.apache.sanselan.common.ImageMetadata.Item;
26 27

  
28
import eu.etaxonomy.cdm.common.UriUtils;
29

  
27 30

  
28 31
/**
29 32
 * @author k.luther
......
96 99
		
97 100
	}
98 101
	
99
	
100
	
102
		
101 103

  
102
	public void readImageInfo(URI imageUri, Integer timeOut) throws IOException{
104
	public void readImageInfo(URI imageUri, Integer timeOut) throws IOException, HttpException{
103 105
		
104 106
		File image = null;
105 107
		InputStream inputStream;
106 108
		try {
107 109
			
108
		
109
			URL imageUrl = imageUri.toURL();    
110
		    
111
			URLConnection connection = imageUrl.openConnection();
112
			connection.setConnectTimeout(timeOut);
113
			
114
			inputStream = connection.getInputStream();
110
			inputStream = UriUtils.getInputStream(imageUri);
115 111

  
116 112
			ImageInfo imageInfo = Sanselan.getImageInfo(inputStream, null);
117 113
			
......
128 124
	}
129 125

  
130 126
	
131
	public void readMetaData(URI mediaUri, Integer timeOut) throws IOException {
127
	public void readMetaData(URI mediaUri, Integer timeOut) throws IOException, HttpException {
132 128
		readImageInfo(mediaUri, timeOut);
133 129
		try {
134
			InputStream inputStream;
135
			URL imageUrl = mediaUri.toURL();    
136
			    
137
			URLConnection connection = imageUrl.openConnection();
138
			connection.setConnectTimeout(timeOut);
139
			inputStream = connection.getInputStream();
130
			InputStream inputStream = UriUtils.getInputStream(mediaUri);
140 131
			
141 132
			IImageMetadata mediaData = Sanselan.getMetadata(inputStream, null);
142 133
			

Also available in: Unified diff