code: @Override
      public FatLfnDirectoryEntry addDirectory(String name) throws IOException {
          checkWritable();
          checkUniqueName(name);
          
          name = name.trim();
          final ShortName sn = makeShortName(name);
          final FatDirectoryEntry real = dir.createSub(fat);
          real.setShortName(sn);
          final FatLfnDirectoryEntry e =
                  new FatLfnDirectoryEntry(this, real, name);
          
          try {
              dir.addEntries(e.compactForm());
          } catch (IOException ex) {
              final ClusterChain cc =
                      new ClusterChain(fat, real.getStartCluster(), false);
              cc.setChainLength(0);
              dir.removeEntry(real);
              throw ex;
          }
          
          shortNameIndex.put(sn, e);
          longNameIndex.put(name.toLowerCase(Locale.ROOT), e);
  
          getDirectory(real);
          
          flush();
          return e;
      }
docs: <p>
  {@inheritDoc}
  </p><p>
  According to the FAT file system specification, leading and trailing
  spaces in the {@code name} are ignored by this method.
  </p>
  
  @param name {@inheritDoc}
  @return {@inheritDoc}
  @throws IOException {@inheritDoc}