Code example for File

Methods: equals

0
   * visually inspected */ 
  protected void printErrorContext(PrintStream errOut) throws IOException
  { 
    final File file = _inputStream.getCurrentFile();
    final long position = _inputStream.getCurrentPosition();
    File lastFile = new File(file.getParentFile(), getLastFileName());
    errOut.println("error between " + lastFile + " @ " + getLastPosition() +
              " and " + _inputStream.getCurrentFile() +
              " @ " + _inputStream.getCurrentPosition());
    RandomAccessFile f = new RandomAccessFile(file, "r");
    try 
    { 
      long startPos = lastFile.equals(file) ? getLastPosition() : 0;
      long endPos = position + ERROR_CONTEXT_LEN;
      int contextSize = (int)(endPos - startPos);
      byte[] context = new byte[contextSize];
      f.seek(startPos);
      if (f.read(context, 0, contextSize) > 0)
      { 
        errOut.println("context: " + new String(context, "ISO-8859-1"));
      }