org.ansj.dic.impl.Url2Stream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ansj_seg Show documentation
Show all versions of ansj_seg Show documentation
best java chinese word seg !
package org.ansj.dic.impl;
import java.io.InputStream;
import java.net.URL;
import org.ansj.dic.PathToStream;
import org.ansj.exception.LibraryException;
/**
* url://http://maven.nlpcn.org/down/library/default.dic
*
* @author ansj
*
*/
public class Url2Stream extends PathToStream {
@Override
public InputStream toStream(String path) {
try {
URL url = new URL(path);
return url.openStream();
} catch (Exception e) {
throw new LibraryException("err to load by http " + path + " message : " + e.getMessage());
}
}
}