Bug 1260241 - Pre: Allow to read from DeflatedFile instances. r?glandium draft
authorNick Alexander <nalexander@mozilla.com>
Sat, 26 Mar 2016 14:17:52 -0700
changeset 345329 70016419a99c553016874b0d8906e3b5058bd28b
parent 345328 4af12748f68724568a088f2cb5d26dba072becd9
child 345330 ef88cda78b4fd2f76cc04929fd2bda0d785f413f
push id14050
push usernalexander@mozilla.com
push dateMon, 28 Mar 2016 20:40:35 +0000
reviewersglandium
bugs1260241
milestone48.0a1
Bug 1260241 - Pre: Allow to read from DeflatedFile instances. r?glandium This allows to interrogate the data in a Jarrer. MozReview-Commit-ID: 4TrwZxGMALH
python/mozbuild/mozpack/files.py
--- a/python/mozbuild/mozpack/files.py
+++ b/python/mozbuild/mozpack/files.py
@@ -500,16 +500,21 @@ class DeflatedFile(BaseFile):
         from mozpack.mozjar import JarFileReader
         assert isinstance(file, JarFileReader)
         self.file = file
 
     def open(self):
         self.file.seek(0)
         return self.file
 
+    def read(self):
+        '''Return the contents of the file.'''
+        self.file.seek(0)
+        return self.file.read()
+
 
 class XPTFile(GeneratedFile):
     '''
     File class for a linked XPT file. It takes several XPT files as input
     (using the add() and remove() member functions), and links them at copy()
     time.
     '''
     def __init__(self):