All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.report.rules.pmd.CheckSkipResult.html Maven / Gradle / Ivy



CheckSkipResult

CheckSkipResult

The skip() method may skip a smaller number of bytes than requested. Check the returned value to find out if it was the case or not. This rule is defined by the following Java class: net.sourceforge.pmd.lang.java.rule.basic.CheckSkipResultRule

Example(s):

        
public class Foo {

   private FileInputStream _s = new FileInputStream("file");

   public void skip(int n) throws IOException {
      _s.skip(n); // You are not sure that exactly n bytes are skipped
   }

   public void skipExactly(int n) throws IOException {
      while (n != 0) {
         long skipped = _s.skip(n);
         if (skipped == 0)
            throw new EOFException();
         n -= skipped;
      }
   }
        




© 2015 - 2024 Weber Informatics LLC | Privacy Policy