Go
Go
Transition from ZipEntry.NextEntry to ZipEntry.GetNext
Provides instructions for replacing deprecated NextEntry method calls with GetNext.Chilkat Go Downloads
success := false
// ------------------------------------------------------------------------
// The NextEntry method is deprecated.
// See below or code showing how to rewrite using EntryAt/GetNext
zip := chilkat.NewZip()
success = zip.OpenZip("qa_data/zips/xml_files.zip")
if success != true {
fmt.Println(zip.LastErrorText())
zip.DisposeZip()
return
}
entry := zip.FirstEntry()
if zip.LastMethodSuccess() == false {
fmt.Println("This zip archive is empty.")
zip.DisposeZip()
return
}
finished := false
for finished == false {
if entry.IsDirectory() == false {
fmt.Println(entry.FileName())
} else {
fmt.Println("(directory) ", entry.FileName())
}
next := entry.NextEntry()
if entry.LastMethodSuccess() == false {
finished = true
}
entry.DisposeZipEntry()
entry = next
}
zip.CloseZip()
fmt.Println("----")
// ------------------------------------------------------------------------
// Do the equivalent using EntryAt/GetNext.
success = zip.OpenZip("qa_data/zips/xml_files.zip")
ze := chilkat.NewZipEntry()
zip.EntryAt(0,ze)
entryValid := true
for entryValid == true {
if ze.IsDirectory() == false {
fmt.Println(ze.FileName())
} else {
fmt.Println("(directory) ", ze.FileName())
}
entryValid = ze.GetNext()
}
zip.CloseZip()
zip.DisposeZip()
ze.DisposeZipEntry()