| 1 | |
package org.jbehave.core.io; |
| 2 | |
|
| 3 | |
import java.net.URL; |
| 4 | |
|
| 5 | |
import org.apache.commons.io.IOUtils; |
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | 2 | public class LoadFromURL implements ResourceLoader, StoryLoader { |
| 11 | |
|
| 12 | |
public String loadResourceAsText(String resourcePath) { |
| 13 | |
try { |
| 14 | 2 | URL url = new URL(resourcePath); |
| 15 | 2 | return IOUtils.toString(url.openStream()); |
| 16 | 1 | } catch (Exception e) { |
| 17 | 1 | throw new InvalidStoryResource(resourcePath, e); |
| 18 | |
} |
| 19 | |
} |
| 20 | |
|
| 21 | |
public String loadStoryAsText(String storyPath) { |
| 22 | 2 | return loadResourceAsText(storyPath); |
| 23 | |
} |
| 24 | |
|
| 25 | |
} |