public void mkdir(String key) throws IOException {
  key=key.replace(" ","");
  if (key.endsWith("/") && !key.equals("/")) {
    throw new InvalidParameterException("Trailing slash not allowed in zookeeper path");
  }
  String[] split=key.split("/");
  StringBuilder builder=new StringBuilder();
  for (  String s : split) {
    builder.append(s);
    if (!s.isEmpty() && !exists(builder.toString())) {
      zkState.set(builder.toString(),null);
    }
    builder.append("/");
  }
}

public void mkdir ( String key ) throws IOException { key = key . replace ( " " , "" ) ; if ( key . endsWith ( "/" ) && ! key . equals ( "/" ) ) { throw new InvalidParameterException ( "Trailing slash not allowed in zookeeper path" ) ; } String [ ] split = key . split ( "/" ) ; StringBuilder builder = new StringBuilder ( ) ; for ( String s : split ) { builder . append ( s ) ; if ( ! s . isEmpty ( ) && ! exists ( builder . toString ( ) ) ) { zkState . set ( builder . toString ( ) , null ) ; } builder . append ( "/" ) ; } }
creates the znode if it does not exist . will create parent directories .
