ScpClient remotely reads linux server files

ask the gods to advise on two questions:
Q1: using scpClient to read the specified file of the remote server, can the file content be converted to line reading or line processing by using the following code? If the following code doesn"t work, what method / class can be used? The code to get all the contents of the file is as follows:

public static String connectError(String node,String path) throws IOException {
    Connection con = new Connection(node);
    ConnectionInfo connect = con.connect();
    boolean isAuthed = con.authenticateWithPassword("user", "123456");
    //System.out.println(node+":"+isAuthed);
    SCPClient scpClient = con.createSCPClient();
    //
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        scpClient.get(path, baos);
    } catch (IOException e) {
        //e.getMessage()
        System.out.println(node+""+path+"");
    }
    //System.out.println("baos"+baos);
    String errorFile = new String(baos.toByteArray(), "utf-8");
    //3
    con.close();
    return  errorFile;
  }

Q2: how do I use scpClient to read the contents of all files in a specified directory on a remote server? If scpClient doesn"t work, how can I remotely get the contents of all the files in the specified directory on the server?

problem description:
Q1 is a file that needs to be accessed remotely from the server, matching the contents of the file that satisfies the regular expression. Because the file is too large, all read into memory processing is not good, so want to convert to line input processing, but did not come into contact with these, so do not know how to deal with, if there is a problem, also ask the gods to advise.
Q2 needs to implement all the contents of files under the directory specified by the remote access server. The files are named in no order, but the prefixes and suffixes are the same. The file name is 20180416 _ random number _ .txt. Count the number of certain strings in all files.

Thank you guys again!

Mar.03,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4dbbd-43c81.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4dbbd-43c81.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?