net.percederberg.mibble
Class FileLocation

java.lang.Object
  |
  +--net.percederberg.mibble.FileLocation

public class FileLocation
extends java.lang.Object

A file location. This class contains a reference to an exact location inside a text file.

Since:
2.0

Constructor Summary
FileLocation(java.io.File file)
          Creates a new file location without an exact line or column reference.
FileLocation(java.io.File file, int line, int column)
          Creates a new file location.
 
Method Summary
 int getColumnNumber()
          Returns the column number.
 java.io.File getFile()
          Returns the file name.
 int getLineNumber()
          Returns the line number.
 java.lang.String readLine()
          Reads the specified line from the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLocation

public FileLocation(java.io.File file)
Creates a new file location without an exact line or column reference.

Parameters:
file - the file name

FileLocation

public FileLocation(java.io.File file,
                    int line,
                    int column)
Creates a new file location.

Parameters:
file - the file name
line - the line number
column - the column number
Method Detail

getFile

public java.io.File getFile()
Returns the file name.

Returns:
the file name

getLineNumber

public int getLineNumber()
Returns the line number.

Returns:
the line number

getColumnNumber

public int getColumnNumber()
Returns the column number.

Returns:
the column number

readLine

public java.lang.String readLine()
Reads the specified line from the file. If the file couldn't be opened or read correctly, null will be returned. The line will NOT contain the terminating '\n' character.

Returns:
the line read, or null if not found