public boolean read(Input in) throws NamingException {
    clear();

    this.in = in;
//    somedata = false;
    haveControls = false;
    crec = null;

    for (;;) {
      int alen = -1;

      try {
        crec = in.readFullLine();
      } catch (Exception e) {
        throwmsg(e.getMessage());
      }

      int inLen = 0;
      if (crec != null) {
        inLen = crec.length();
      }

      /*
       System.out.println("ldifrec len=" + inLen + " data=" + crec +
           " state=" + state); */

      if (crec != null) {
        ldifData.addElement(crec);

        alen = crec.indexOf(':');
      }

      // Null terminator means we're done
      if (inLen == 0) {
        // There are some state we should not be in here
        if (state == stateModSpec) { // Any others?
          invalid();
        }
        break;
      }

      if ((inLen > 0) && (crec.startsWith("#"))) {
        // Comment line. Ignore it.
      } else if (alen > 0) {
        /** We have something of the form
               <name> : <val> or
               <name> :: <encoded-val> or    for base-64 encoded data
               <name> :< <url>               for the url of an inclusion
         */
        String attr = null;
        StringBuffer val = null;
        boolean encoded = false;
        boolean url = false;
        int valStart;

        valStart = alen + 1;

        if (valStart == inLen) {
          throw new NamingException("Bad input value \"" + crec + "\"");
        } else if ((alen < inLen) && (crec.charAt(valStart) == ':')) {
          valStart++;
          encoded = true;
        } else if ((alen < inLen) && (crec.charAt(valStart) == '<')) {
          valStart++;
          url = true;
        }

        while ((valStart < inLen) && (crec.charAt(valStart) == ' ')) {
          valStart++;
        }

        attr = crec.substring(0, alen).toLowerCase();
        val = new StringBuffer(crec.substring(valStart));

        addAttrVal(attr, val.toString(), encoded, url);
      } else if ((state == stateModSpec) && (inLen == 1) && (crec.equals("-"))) {
        // We have a current change to add to the change vector.
        if (changes == null) {
          changes = new Vector();
        }
        changes.addElement(curChange);
        curChange = null;
        state = stateModify;
      } else if (inLen > 0) {
        invalid();
      }
    }

    return somedata;
  }
public boolean read ( Input in ) throws NamingException { clear ( ) ; this . in = in ; haveControls = false ; crec = null ; for ( ; ; ) { int alen = - 1 ; try { crec = in . readFullLine ( ) ; } catch ( Exception e ) { throwmsg ( e . getMessage ( ) ) ; } int inLen = 0 ; if ( crec != null ) { inLen = crec . length ( ) ; } if ( crec != null ) { ldifData . addElement ( crec ) ; alen = crec . indexOf ( ':' ) ; } if ( inLen == 0 ) { if ( state == stateModSpec ) { invalid ( ) ; } break ; } if ( ( inLen > 0 ) && ( crec . startsWith ( "#" ) ) ) { } else if ( alen > 0 ) { String attr = null ; StringBuffer val = null ; boolean encoded = false ; boolean url = false ; int valStart ; valStart = alen + 1 ; if ( valStart == inLen ) { throw new NamingException ( "Bad input value \"" + crec + "\"" ) ; } else if ( ( alen < inLen ) && ( crec . charAt ( valStart ) == ':' ) ) { valStart ++ ; encoded = true ; } else if ( ( alen < inLen ) && ( crec . charAt ( valStart ) == '<' ) ) { valStart ++ ; url = true ; } while ( ( valStart < inLen ) && ( crec . charAt ( valStart ) == ' ' ) ) { valStart ++ ; } attr = crec . substring ( 0 , alen ) . toLowerCase ( ) ; val = new StringBuffer ( crec . substring ( valStart ) ) ; addAttrVal ( attr , val . toString ( ) , encoded , url ) ; } else if ( ( state == stateModSpec ) && ( inLen == 1 ) && ( crec . equals ( "-" ) ) ) { if ( changes == null ) { changes = new Vector ( ) ; } changes . addElement ( curChange ) ; curChange = null ; state = stateModify ; } else if ( inLen > 0 ) { invalid ( ) ; } } return somedata ; }
Read an entire ldif record from an input stream

@param   in Input object to read from input stream
@return  boolean  true if we read some ldif data.
false if there was no data