[openrtm-commit:02428] r675 - trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 2月 11日 (土) 11:42:53 JST


Author: ga
Date: 2017-02-11 11:42:53 +0900 (Sat, 11 Feb 2017)
New Revision: 675

Modified:
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java
Log:
Modified the character code of the generation codes. #3898

Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java	2017-02-06 14:54:51 UTC (rev 674)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java	2017-02-11 02:42:53 UTC (rev 675)
@@ -1,9 +1,12 @@
 package jp.go.aist.rtm.rtcbuilder;
 
+import java.io.BufferedWriter;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.io.StringReader;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -618,9 +621,21 @@
 					}
 				}
 			}
+//			try {
+//				outputFile.create(new ByteArrayInputStream(generatedResult.getCode().getBytes("UTF-8")), false, null);
+//			} catch (CoreException e) {
+//				LOGGER.error("Fail to create file", e);
+//			}
 			try {
-				outputFile.create(new ByteArrayInputStream(generatedResult.getCode().getBytes("UTF-8")), false, null);
-			} catch (CoreException e) {
+				String strFullPath = outputFile.getLocation().toOSString();
+				FileOutputStream fos = new FileOutputStream(strFullPath);
+				fos.write(0xef); fos.write(0xbb); fos.write(0xbf);				
+				OutputStreamWriter osw = new OutputStreamWriter( fos , "UTF-8");
+				BufferedWriter fp = new BufferedWriter( osw );
+				fp.write ( generatedResult.getCode());
+				fp.flush();
+				fp.close();				
+			} catch (Exception e) {
 				LOGGER.error("Fail to create file", e);
 			}
 		}



More information about the openrtm-commit mailing list