TogaGemは、3D動画制作ツール、MikuMikuDance(MMD)で用いられる各種データファイルを読み書きするためのJavaライブラリです。
旧TogaParserライブラリの資産は、TogaGemライブラリに吸収されました。
Revision | 545fd816cd685eb349d56cf11590fb6d6b0c41b8 (tree) |
---|---|
Zeit | 2013-04-17 20:12:37 |
Autor | <olyutorskii@user...> |
JRE1.6と1.7の差を吸収
@@ -106,8 +106,12 @@ | ||
106 | 106 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
107 | 107 | |
108 | 108 | exporter = new TextExporter(CS_UTF8); |
109 | + // JRE 1.6 と 1.7 でびみょーに違う | |
110 | + float maxb = CS_UTF8.newEncoder().maxBytesPerChar(); | |
111 | + | |
109 | 112 | exporter.setCharBufSize(1); |
110 | - exporter.setByteBufSize(4); | |
113 | + int minb = (int)( StrictMath.floor(maxb) ); | |
114 | + exporter.setByteBufSize(minb); | |
111 | 115 | bout.reset(); |
112 | 116 | try{ |
113 | 117 | exporter.encodeToByteStream("あいう", bout); |
@@ -117,7 +121,8 @@ | ||
117 | 121 | assertEquals(9, bout.size()); |
118 | 122 | |
119 | 123 | try{ |
120 | - exporter.setByteBufSize(3); | |
124 | + int failSize = minb - 1; | |
125 | + exporter.setByteBufSize(failSize); | |
121 | 126 | fail(); |
122 | 127 | }catch(IllegalArgumentException e){ |
123 | 128 | // GOOD |