private boolean isSessionRecording(File file) {

        Reader reader = null;
        try {
            reader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8);

            GuacamoleReader guacReader = new ReaderGuacamoleReader(reader);
            if (guacReader.readInstruction() != null)
                return true;

        }
        catch (GuacamoleException e) {
            logger.debug("File \"{}\" does not appear to be a session "
                    + "recording, as it could not be parsed as Guacamole "
                    + "protocol data.", file, e);
        }
        catch (IOException e) {
            logger.warn("Possible session recording \"{}\" could not be "
                    + "identified as it cannot be read: {}", file, e.getMessage());
            logger.debug("Possible session recording \"{}\" could not be read.", file, e);
        }
        finally {

            // If the reader was successfully constructed, close it
            if (reader != null) {

                try {
                    reader.close();
                }

                catch (IOException e) {
                    logger.warn("Unexpected error closing recording file \"{}\": {}",
                            file, e.getMessage());
                    logger.debug("Session recording file \"{}\" could not be closed.",
                            file, e);
                }

            }
        }

        return false;

    }
Returns whether the given file appears to be a Guacamole session
recording. As there is no standard extension for session recordings,
this is determined by attempting to read a single Guacamole instruction
from the file.

@param file
    The file to test.

@return
    true if the file appears to be a Guacamole session recording, false
    otherwise.
extensions/guacamole-history-recording-storage/src/main/java/org/apache/guacamole/history/connection/HistoryConnectionRecord.java