• Post Reply Bookmark Topic Watch Topic
  • New Topic

I am getting "incompatible types" error during compiling when I use FileUtils.lineIterator method.  RSS feed

 
narendra nath
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Apache commons packages related to IO to read lines in a text file.


Error:(108, 56) java: incompatible types: java.lang.String cannot be converted to java.io.File
 
Stephan van Hulst
Saloon Keeper
Posts: 7972
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the lineIterator() API description?
 
John Christensen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
static LineIterator lineIterator(File file) Returns an Iterator for the lines in a File using the default encoding for the VM.
static LineIterator lineIterator(File file, String encoding) Returns an Iterator for the lines in a File.

Here's what I've found here:

https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html
 
Campbell Ritchie
Marshal
Posts: 56534
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
narendra nath
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks folks

Resolved.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!