/**
   * Reads functional diagram blocks descriptions from functional diagram file.
   *
   * @throws FileNotFoundException
   * @throws IOException
   * @param filePath Path to functional diagram file
   * @param fileHeader Yokogawa file header instance
   * @return List of Yokogawa functional block records
   */
  private List<YgBlockRecord> _readFbdBlocks(String filePath, YgFileHeader fbdHeader)
      throws FileNotFoundException, IOException {
    RandomAccessFile diagramFile = new RandomAccessFile(filePath, "r");

    List<YgBlockRecord> result = new ArrayList<YgBlockRecord>();
    YgFileHeaderContents contentItem;

    contentItem = fbdHeader.getContentItem("RGTL");
    if (contentItem == null) return result;

    long count = contentItem.getNumber();
    if (count <= 0) return result;

    // Move file pointer to beginning of section with functinal blocks description:
    diagramFile.seek(contentItem.getOffset());
    YgBlockRecord tempBlockDescription;
    byte[] temp48BytesArray = new byte[48];

    // Read all available block records:
    for (int i = 0; i < count; i++) {
      diagramFile.read(temp48BytesArray);
      tempBlockDescription = new YgBlockRecord(temp48BytesArray);
      result.add(tempBlockDescription);
    } // for

    diagramFile.close();
    return result;
  } // _readFbdBlocks
  /**
   * Reads functional block tags set from Yokogawa DCS backup file content.
   *
   * @throws FileNotFoundException
   * @throws IOException
   * @param filePath Path to file
   * @param blockFileHeader Yokogawa file header instance
   * @return List of Yokogawa tag record instances
   */
  private List<YgTagRecord> _readAsBlockTagsList(String filePath, YgFileHeader blockFileHeader)
      throws FileNotFoundException, IOException {
    RandomAccessFile blockFile = new RandomAccessFile(filePath, "r");

    List<YgTagRecord> result = new ArrayList<YgTagRecord>();
    YgFileHeaderContents contentItem;

    contentItem = blockFileHeader.getContentItem("HTLT");
    if (contentItem == null) return result;

    long count = contentItem.getNumber();
    if (count <= 0) return result;

    // Move file pointer to beginning of section with functinal block's tag descriptions:
    blockFile.seek(contentItem.getOffset());
    byte[] tagRecordBytes = new byte[128];

    // Read all available tag records:
    for (int i = 0; i < count; i++) {
      blockFile.read(tagRecordBytes);
      YgTagRecord tagRecord = new YgTagRecord(tagRecordBytes);
      result.add(tagRecord);
    } // for

    blockFile.close();
    return result;
  } // _readAsBlockTagsList
  /**
   * Reads engineering units library file.
   *
   * @throws FileNotFoundException
   * @throws IOException
   * @param filePath Path to engineering units file
   * @param fileHeader Yokogawa file header instance
   * @return Engineering unit names collection
   */
  private List<String> _readAsEngUnitsList(String filePath, YgFileHeader fileHeader)
      throws FileNotFoundException, IOException {
    List<String> result = new ArrayList();
    RandomAccessFile engUnitsFile = new RandomAccessFile(filePath, "r");
    YgFileHeaderContents contentItem;

    contentItem = fileHeader.getContentItem("EUNT");
    if (contentItem == null) return result;

    long count = contentItem.getNumber();
    if (count <= 0) return result;

    // Move file pointer to beginning of section with units description:
    engUnitsFile.seek(contentItem.getOffset());
    byte[] tempUnitsBytes = new byte[8];
    String tempUnits;

    // Read all available units:
    for (int i = 0; i < count; i++) {
      engUnitsFile.read(tempUnitsBytes);
      tempUnits = new String(tempUnitsBytes);
      result.add(tempUnits);
    } // for

    engUnitsFile.close();
    return result;
  } // _readAsEngUnitsList
  /**
   * Reads functional block's tuning parameters as string.
   *
   * @throws FileNotFoundException
   * @throws IOException
   * @param filePath Path to file
   * @param blockFileHeader Yokogawa file header instance
   * @return Block tuning parameters string
   */
  private String _readBlockTuningParameters(String filePath, YgFileHeader blockFileHeader)
      throws FileNotFoundException, IOException {
    RandomAccessFile blockFile = new RandomAccessFile(filePath, "r");
    String result = "";

    YgFileHeaderContents contentItem;

    contentItem = blockFileHeader.getContentItem("HTLT");
    if (contentItem == null) return result;

    long count = contentItem.getNumber();
    if (count <= 0) return result;

    // Move file pointer to beginning of section with functinal block's tuning parameters:
    blockFile.seek(contentItem.getOffset() + 128 * count);
    byte[] blockParamsBytes = new byte[1024];

    blockFile.read(blockParamsBytes);
    return new String(blockParamsBytes);
  } // _readBlockTuningParameters