public static void readOptionalFields(BufferStream readBuffer, MapFileInfoBuilder mapFileInfoBuilder) { OptionalFields optionalFields = new OptionalFields((byte)readBuffer.ReadByte()); mapFileInfoBuilder.optionalFields = optionalFields; optionalFields.ReadOptionalFields(readBuffer); }
/** * Reads and validates the header block from the map file. * * @param readBuffer * the ReadBuffer for the file data. * @param fileSize * the size of the map file in bytes. * @return a FileOpenResult containing an error message in case of a failure. * @throws IOException * if an error occurs while reading the file. */ public void ReadHeader(BufferStream readBuffer, long fileSize) { RequiredFields.ReadMagicbyte(readBuffer); RequiredFields.ReadRemainingHeader(readBuffer); MapFileInfoBuilder mapFileInfoBuilder = new MapFileInfoBuilder(); RequiredFields.ReadFileVersion(readBuffer, mapFileInfoBuilder); RequiredFields.ReadFileSize(readBuffer, fileSize, mapFileInfoBuilder); RequiredFields.ReadMapDate(readBuffer, mapFileInfoBuilder); RequiredFields.ReadBoundingBox(readBuffer, mapFileInfoBuilder); RequiredFields.ReadTilePixelSize(readBuffer, mapFileInfoBuilder); RequiredFields.ReadProjectionName(readBuffer, mapFileInfoBuilder); mapFileInfoBuilder.Projection = new RepresentationConverter(Projections.GetProjection(mapFileInfoBuilder.projectionName), mapFileInfoBuilder.tilePixelSize); OptionalFields.readOptionalFields(readBuffer, mapFileInfoBuilder); RequiredFields.ReadNodeTags(readBuffer, mapFileInfoBuilder); RequiredFields.ReadWayTags(readBuffer, mapFileInfoBuilder); ReadSubFileParameters(readBuffer, fileSize, mapFileInfoBuilder); this.mapFileInfo = mapFileInfoBuilder.build(); }