java/dbloader/src/main/java/be/bosa/dt/best/dbloader/CsvPreparer.java
/**
	 * Write postal code info
	 * 
	 * @param xmlPath XML BeST directory
	 * @param csvPath CSV output directory
	 * @throws IOException 
	 */
Write postal code info

@param xmlPath XML BeST directory
@param csvPath CSV output directory
@throws IOException
Write postal code info @param xmlPath XML BeST directory @param csvPath CSV output directory @throws IOException
private void writePostals(Path xmlPath, Path csvPath) throws IOException {
		try(CsvWriter w = builder.build(csvPath.resolve("postals.csv"), StandardCharsets.UTF_8)) {
			for (BestRegion reg: new BestRegion[] { BestRegion.BRUSSELS, BestRegion.FLANDERS, BestRegion.WALLONIA }) {
				LOG.log(Level.INFO, "Starting postals {0}", reg.getName());
				int cnt = 0;
				PostalReader reader = new PostalReader();
				Stream<Postal> postals = reader.read(reg, xmlPath);
				Iterator<Postal> iter = postals.iterator();
				while (iter.hasNext()) {
					Postal a = iter.next();
					w.writeRow(NsConverter.postalEncode(a.getIDVersion()), "1", a.getId(),
								a.getName("nl"), a.getName("fr"), a.getName("de"));
					if (++cnt % 10_000 == 0) {
						LOG.log(Level.INFO, "Wrote {0}", cnt);
					}
				}
				LOG.log(Level.INFO, "Wrote {0}", cnt);
			}
		}
	}
private void writePostals ( Path xmlPath , Path csvPath ) throws IOException { try ( CsvWriter w = builder . build ( csvPath . resolve ( "postals.csv" ) , StandardCharsets . UTF_8 ) ) { for ( BestRegion reg : new BestRegion [ ] { BestRegion . BRUSSELS , BestRegion . FLANDERS , BestRegion . WALLONIA } ) { LOG . log ( Level . INFO , "Starting postals {0}" , reg . getName ( ) ) ; int cnt = 0 ; PostalReader reader = new PostalReader ( ) ; Stream < Postal > postals = reader . read ( reg , xmlPath ) ; Iterator < Postal > iter = postals . iterator ( ) ; while ( iter . hasNext ( ) ) { Postal a = iter . next ( ) ; w . writeRow ( NsConverter . postalEncode ( a . getIDVersion ( ) ) , "1" , a . getId ( ) , a . getName ( "nl" ) , a . getName ( "fr" ) , a . getName ( "de" ) ) ; if ( ++ cnt % 10_000 == 0 ) { LOG . log ( Level . INFO , "Wrote {0}" , cnt ) ; } } LOG . log ( Level . INFO , "Wrote {0}" , cnt ) ; } } }
Write postal code info
Write postal code info