commonlib/src/main/java/com/streamsets/pipeline/lib/util/FileContextProviderUtil.java
public static long getOffsetLagForFile(String fileOffsetString) throws IOException {
    long offset = FileContextProviderUtil.getLongOffsetFromFileOffset(fileOffsetString);
    //We are refreshing the live file here because we are going to get the size by using path.
    LiveFile file = FileContextProviderUtil.getRefreshedLiveFileFromFileOffset(fileOffsetString);
    long fileSizeInBytes = Files.size(file.getPath().toAbsolutePath());
    return (fileSizeInBytes - offset);
  }
public static long getOffsetLagForFile(String fileOffsetString) throws IOException {
    long offset = FileContextProviderUtil.getLongOffsetFromFileOffset(fileOffsetString);
    //We are refreshing the live file here because we are going to get the size by using path.
    LiveFile file = FileContextProviderUtil.getRefreshedLiveFileFromFileOffset(fileOffsetString);
    long fileSizeInBytes = Files.size(file.getPath().toAbsolutePath());
    return (fileSizeInBytes - offset);
  }
If passed a valid fileOffsetString, it will return what is the offset lag in the file.
@param fileOffsetString
@return offset lag for the live file.
@throws IOException