it may be useful to have a version that does not load the entire file in memory, with something like (untested):
class FileInputStream(unohelper.Base, XInputStream, XSeekable):
""" Minimal Implementation of XInputStream """
def __init__(self, filename):
self.filename = filename
self.size = os.path.getsize(self.filename)
self.file = open(filename, 'rb')
def readBytes(self, foo, n):
foo = self.file.read(n)
return (len(foo), uno.ByteSequence(foo))
def readSomeBytes(self, foo, n):
return self.readBytes(foo, n)
def skipBytes(self, n):
self.file.seek (n, 1)
def available(self):
return self.size - self.file.tell();
def closeInput(self):
self.file.close()
def seek(self, posn):
self.file.seek(int(posn))
def getPosition(self):
return long(self.file.tell())
def getLength(self):
return long(self.size)
David
2005/11/14, Laurent Godard <
[EMAIL PROTECTED]>:
Hi pierre
> Hi, the google link is a response to one of my question to the list
> [email protected]
>
> look in the archive for subject
> "making a copy of the current document"
>
> The code you cited is from Joerg Budischewski and it worked perfectly
> well with OOo1.1 but I never tested it with OOo2.
>
thanks for this precision
and thanks to Joerg too
I'll test it on OOo 2 but i expect it to work
Laurent
--
Laurent Godard < [EMAIL PROTECTED]> - Ingénierie OpenOffice.org
Indesko >> http://www.indesko.com
Nuxeo CPS >> http://www.nuxeo.com - http://www.cps-project.org
Livre "Programmation OpenOffice.org", Eyrolles 2004
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
