Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1;
  
  
      extends LimitedInputStream
  {
     private int _b1;
     private int _b2;
     private boolean _eofReached = false;
     private boolean _eofOn00 = true;
 
         InputStream in,
         int         limit)
         throws IOException
     {
         super(inlimit);
 
          = in.read();
          = in.read();
 
         if ( < 0)
         {
             // Corrupted stream
             throw new EOFException();
         }
 
         checkForEof();
     }
 
     void setEofOn00(
         boolean eofOn00)
     {
          = eofOn00;
         checkForEof();
     }
 
     private boolean checkForEof()
     {
         if (! &&  && ( == 0x00 &&  == 0x00))
         {
              = true;
             setParentEofDetect(true);
         }
         return ;
     }
 
     public int read(byte[] bint offint len)
         throws IOException
     {
         // Only use this optimisation if we aren't checking for 00
         if ( || len < 3)
         {
             return super.read(bofflen);
         }
 
         if ()
         {
             return -1;
         }
 
         int numRead = .read(boff + 2, len - 2);
 
         if (numRead < 0)
         {
             // Corrupted stream
             throw new EOFException();
         }
 
         b[off] = (byte);
         b[off + 1] = (byte);
 
          = .read();
          = .read();
 
         if ( < 0)
         {
             // Corrupted stream
             throw new EOFException();
         }
 
         return numRead + 2;
     }
 
     public int read()
         throws IOException
     {
         if (checkForEof())
         {
             return -1;
         }
 
         int b = .read();
 
         if (b < 0)
         {
            // Corrupted stream
            throw new EOFException();
        }
        int v = ;
         = ;
         = b;
        return v;
    }
New to GrepCode? Check out our FAQ X