OSDN Git Service

implementing export_pmx...
[meshio/pymeshio.git] / pymeshio / common.py
index e8e385c..9083fb6 100644 (file)
@@ -5,6 +5,7 @@ common utilities.
 import math\r
 import struct\r
 import sys\r
+import io\r
 \r
 \r
 def unicode(src):\r
@@ -311,10 +312,16 @@ class BinaryReader(object):
     """general BinaryReader\r
     """\r
     def __init__(self, ios):\r
+        current=ios.tell()\r
+        ios.seek(0, io.SEEK_END)\r
+        self.end=ios.tell()\r
+        ios.seek(current)\r
         self.ios=ios\r
 \r
     def is_end(self):\r
-        return not self.ios.readable()\r
+        #print(self.ios.tell(), self.end)\r
+        return self.ios.tell()>=self.end\r
+        #return not self.ios.readable()\r
 \r
     def unpack(self, fmt, size):\r
         result=struct.unpack(fmt, self.ios.read(size))\r