question: public KMZWriter ( final String outFilename ) { log . setLevel ( Level . INFO ) ; String filename = outFilename ; if ( filename . endsWith ( ".kml" ) || filename . endsWith ( ".kmz" ) ) { filename = filename . substring ( 0 , filename . length ( ) - 4 ) ; } try { this . zipOut = new ZipOutputStream ( new FileOutputStream ( filename + ".kmz" ) ) ; this . out = new BufferedWriter ( new OutputStreamWriter ( this . zipOut , "UTF8" ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } KmlType docKML = kmlObjectFactory . createKmlType ( ) ; NetworkLinkType nl = kmlObjectFactory . createNetworkLinkType ( ) ; LinkType link = kmlObjectFactory . createLinkType ( ) ; link . setHref ( "main.kml" ) ; nl . setLink ( link ) ; docKML . setAbstractFeatureGroup ( kmlObjectFactory . createNetworkLink ( nl ) ) ; writeKml ( "doc.kml" , docKML ) ; }
target:  Creates a new kmz-file and a writer for it and opens the file for writing.