class TapeDriveStatusParser {

    public TapeDriveState parse(String output) {
        ParametersChecker.checkParameter("All params is required", output);

        final TapeDriveState tapeDriveState = new TapeDriveState(StatusCode.OK);
        for (String s : output.split("\n")) {

            if (s.contains(TAPE_DRIVE)) {
                tapeDriveState.setDescription(s.trim());

            } else if (s.contains(FILE_NUMBER)) {
                extractFileAndBlockNumberAndPartition(tapeDriveState, s);


            } else if (s.contains(TAPE_BLOCK_SIZE)) {
                extractBlockSizeAndDensity(tapeDriveState, s);


            } else if (s.contains(SOFT_ERROR)) {
                extractSoftErrorCount(tapeDriveState, s);

            } else if (s.contains(GENERAL_STATUS)) {
                extractGeneralStatus(tapeDriveState, s);

            } else {
                extractDriveStatus(tapeDriveState, s);
            }
        }

        return tapeDriveState;
    }

}