/**
* s3에 접속 - 사전을 업로드 한다.
* @throws IOException
*/
public void uploadDictionary(FileParameter parameter) throws IOException {
String fileName = parameter.getDicName();
String path = makePath();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for(String s: parameter.getKeyword()){
baos.write(s.getBytes(“UTF-8”));
baos.write(‘\n’);
}
byte[] fileArray = baos.toByteArray();
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentType(“text/plain”);
metadata.setContentEncoding(“UTF-8”);
metadata.setContentLength(fileArray.length);
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName+path, “bak_“+fileName, new ByteArrayInputStream(fileArray) , metadata);
amazonS3.putObject(putObjectRequest);
if(amazonS3.doesObjectExist(bucketName+path,“bak_“+fileName)){
renameDictionary(fileName);
}
}