use of au.gov.amsa.ihs.reader.Key in project risky by amsa-code.
the class SabineMain method main.
public static void main(String[] args) throws FileNotFoundException {
File file = new File("/media/an/ship-data/ihs/608750-2015-04-01.zip");
List<Key> keys = Arrays.asList(Key.LRIMOShipNo, Key.ShipName, Key.ShipbuilderCompanyCode, Key.CountryOfBuildCode, Key.MainEngineBuilderCode, Key.MainEngineDesignerCode, Key.MainEngineModel, Key.MainEngineType, Key.PropulsionTypeCode, Key.PropulsionType, Key.DeathDate, Key.DeliveryDate, Key.DateOfBuild, Key.Deadweight, Key.GrossTonnage, Key.LengthOverallLOA, Key.LiquidCapacity, Key.TEU, Key.PassengerCapacity, Key.StatCode5, Key.ShipStatus, Key.ShipStatusCode, Key.ShipStatusEffectiveDate, Key.FlagCode, Key.ClassificationSocietyCode, Key.DocumentofComplianceDOCCompanyCode);
try (PrintStream out = new PrintStream("target/ships.txt")) {
out.println(keys.stream().map(key -> key.name()).collect(Collectors.joining("\t")));
IhsReader.fromZip(file).map(map -> {
return keys.stream().map(key -> map.get(key.name())).map(x -> x == null ? "" : x).collect(Collectors.joining("\t"));
}).doOnNext(out::println).subscribe();
}
}
Aggregations