| @@ -3,6 +3,7 @@ package com.iformall.language; | |||||
| import com.cybozu.labs.langdetect.Detector; | import com.cybozu.labs.langdetect.Detector; | ||||
| import com.cybozu.labs.langdetect.DetectorFactory; | import com.cybozu.labs.langdetect.DetectorFactory; | ||||
| import com.cybozu.labs.langdetect.LangDetectException; | import com.cybozu.labs.langdetect.LangDetectException; | ||||
| import com.google.common.io.ByteStreams; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import lombok.var; | import lombok.var; | ||||
| import org.springframework.core.io.Resource; | import org.springframework.core.io.Resource; | ||||
| @@ -28,15 +29,9 @@ public class LanguageDetect { | |||||
| PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); | PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); | ||||
| Resource[] resources = resolver.getResources("classpath:profiles/*"); | Resource[] resources = resolver.getResources("classpath:profiles/*"); | ||||
| for (Resource resource:resources) { | for (Resource resource:resources) { | ||||
| try { | |||||
| InputStream inputStream = resource.getInputStream(); | |||||
| byte[] bytes = new byte[0]; | |||||
| inputStream.read(bytes); | |||||
| profile.add(new String(bytes)); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| InputStream inputStream = resource.getInputStream(); | |||||
| String str = new String(ByteStreams.toByteArray(inputStream)); | |||||
| profile.add(str); | |||||
| } | } | ||||
| } catch (IOException e) { | } catch (IOException e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||