Search code examples
groovycompiler-errorssftpremote-accessdatainputstream

Reading file from remote server using groovy


I am trying to read a specific entry in a file on a remote Linux server, I have no idea how to do it, i searched around and below is what i am trying but it doesnt work and throwing exceptions

Below is the exception i get , Can some one also confirm if the above code is OK?

 latest.groovy: 50: expecting EOF, found 'in' @ line 50, column 17.
 DataInputStream in = new DataInputStream(io)
               ^

 1 error

Solution

  • in is a keyword in groovy.

    Change the variable name to something else...

    Maybe dataInputStream ?

    You can find a list of the keywords here http://docs.groovy-lang.org/latest/html/documentation/#_keywords