ZipArchive.st
changeset 2524 364d34cb6192
parent 2518 6d16c590ba0a
child 2550 fba099d1ff46
equal deleted inserted replaced
2523:cae6bc936653 2524:364d34cb6192
  3754 
  3754 
  3755     "Created: / 29.3.1998 / 19:15:15 / cg"
  3755     "Created: / 29.3.1998 / 19:15:15 / cg"
  3756     "Modified: / 30.3.1998 / 17:13:47 / cg"
  3756     "Modified: / 30.3.1998 / 17:13:47 / cg"
  3757 ! !
  3757 ! !
  3758 
  3758 
       
  3759 !ZipArchive methodsFor:'queries'!
       
  3760 
       
  3761 isValidPath: anArchivePathName
       
  3762     ^ self members
       
  3763         contains:[:aMember |
       
  3764             |fn|
       
  3765 
       
  3766             fn := aMember fileName.
       
  3767             ((fn startsWith:anArchivePathName,'/') or:[(fn = anArchivePathName)])
       
  3768         ].
       
  3769 
       
  3770     "/ cg: wrong - what about (isValidPath:'foo'), if there is a file named 'foobar' ?!!
       
  3771 "/    self members do: [:aMember|
       
  3772 "/        (aMember fileName startsWith:anArchivePathName) ifTrue:[
       
  3773 "/            ^ true
       
  3774 "/        ].
       
  3775 "/    ].
       
  3776 "/    ^ false
       
  3777 ! !
       
  3778 
  3759 !ZipArchive methodsFor:'reading'!
  3779 !ZipArchive methodsFor:'reading'!
  3760 
  3780 
  3761 extract:fileName
  3781 extract:fileName
  3762     "extract an entry identified by fileName as a byteArray;
  3782     "extract an entry identified by fileName as a byteArray;
  3763      nil on errors"
  3783      nil on errors"
  3954 
  3974 
  3955     file position0Based:(zipEntry fileStart + startOfArchive).
  3975     file position0Based:(zipEntry fileStart + startOfArchive).
  3956 
  3976 
  3957     ^ (ZipReadStream zipFileStream:file zipEntry:zipEntry)
  3977     ^ (ZipReadStream zipFileStream:file zipEntry:zipEntry)
  3958         zipArchive:self.
  3978         zipArchive:self.
  3959 ! !
       
  3960 
       
  3961 !ZipArchive methodsFor:'testing'!
       
  3962 
       
  3963 isValidPath: anArchivePathName
       
  3964     ^ self members
       
  3965         contains:[:aMember |
       
  3966             |fn|
       
  3967 
       
  3968             fn := aMember fileName.
       
  3969             ((fn startsWith:anArchivePathName,'/') or:[(fn = anArchivePathName)])
       
  3970         ].
       
  3971 
       
  3972     "/ cg: wrong - what about (isValidPath:'foo'), if there is a file named 'foobar' ?!!
       
  3973 "/    self members do: [:aMember|
       
  3974 "/        (aMember fileName startsWith:anArchivePathName) ifTrue:[
       
  3975 "/            ^ true
       
  3976 "/        ].
       
  3977 "/    ].
       
  3978 "/    ^ false
       
  3979 ! !
  3979 ! !
  3980 
  3980 
  3981 !ZipArchive methodsFor:'writing'!
  3981 !ZipArchive methodsFor:'writing'!
  3982 
  3982 
  3983 addArchiveDirectory: archiveDirectoryName fromOsDirectory: osDirectoryName
  3983 addArchiveDirectory: archiveDirectoryName fromOsDirectory: osDirectoryName
  4491 compressionMethod:something
  4491 compressionMethod:something
  4492     compressionMethod := something.
  4492     compressionMethod := something.
  4493 !
  4493 !
  4494 
  4494 
  4495 crc32
  4495 crc32
  4496     "return the value of the instance variable 'crc32' (automatically generated)"
       
  4497 
       
  4498     ^ crc32
  4496     ^ crc32
  4499 
  4497 
  4500     "Created: / 29.3.1998 / 20:03:00 / cg"
  4498     "Created: / 29-03-1998 / 20:03:00 / cg"
       
  4499     "Modified: / 21-01-2011 / 00:04:48 / cg"
  4501 !
  4500 !
  4502 
  4501 
  4503 crc32:something
  4502 crc32:something
  4504     "set the value of the instance variable 'crc32' (automatically generated)"
       
  4505 
       
  4506     crc32 := something.
  4503     crc32 := something.
  4507 
  4504 
  4508     "Created: / 29.3.1998 / 20:03:00 / cg"
  4505     "Created: / 29-03-1998 / 20:03:00 / cg"
       
  4506     "Modified: / 21-01-2011 / 00:04:52 / cg"
  4509 !
  4507 !
  4510 
  4508 
  4511 data
  4509 data
  4512     "return the value of the instance variable 'data' (automatically generated)"
       
  4513 
       
  4514     ^ data
  4510     ^ data
  4515 
  4511 
  4516     "Created: / 9.4.1998 / 13:05:03 / cg"
  4512     "Created: / 09-04-1998 / 13:05:03 / cg"
       
  4513     "Modified: / 21-01-2011 / 00:04:57 / cg"
  4517 !
  4514 !
  4518 
  4515 
  4519 data:something
  4516 data:something
  4520     "set the value of the instance variable 'data' (automatically generated)"
       
  4521 
       
  4522     data := something.
  4517     data := something.
  4523 
  4518 
  4524     "Created: / 9.4.1998 / 13:05:03 / cg"
  4519     "Created: / 09-04-1998 / 13:05:03 / cg"
       
  4520     "Modified: / 21-01-2011 / 00:05:00 / cg"
  4525 !
  4521 !
  4526 
  4522 
  4527 dataStart
  4523 dataStart
  4528     "tell the file offset, where tha data of this zip entry starts"
  4524     "tell the file offset, where tha data of this zip entry starts"
  4529     dataStart isNil ifTrue: [
  4525     dataStart isNil ifTrue: [
  5020 ! !
  5016 ! !
  5021 
  5017 
  5022 !ZipArchive class methodsFor:'documentation'!
  5018 !ZipArchive class methodsFor:'documentation'!
  5023 
  5019 
  5024 version
  5020 version
  5025     ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.90 2010-12-22 11:23:51 sr Exp $'
  5021     ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.91 2011-01-20 23:15:41 cg Exp $'
  5026 !
  5022 !
  5027 
  5023 
  5028 version_CVS
  5024 version_CVS
  5029     ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.90 2010-12-22 11:23:51 sr Exp $'
  5025     ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.91 2011-01-20 23:15:41 cg Exp $'
  5030 ! !
  5026 ! !
  5031 
  5027 
  5032 ZipArchive initialize!
  5028 ZipArchive initialize!