public SetupHeader(VorbisStream vorbis, BitInputStream source) throws VorbisFormatException, IOException {

      if(source.getLong(48)!=HEADER) {
         throw new VorbisFormatException("The setup header has an illegal leading.");
      }

      // read code books

      int codeBookCount=source.getInt(8)+1;
      codeBooks=new CodeBook[codeBookCount];

      for(int i=0; i<codeBooks.length; i++) {
         codeBooks[i]=new CodeBook(source);
      }

      // read the time domain transformations,
      // these should all be 0

      int timeCount=source.getInt(6)+1;
      for(int i=0; i<timeCount; i++) {
         if(source.getInt(16)!=0) {
            throw new VorbisFormatException("Time domain transformation != 0");
         }
      }

      // read floor entries

      int floorCount=source.getInt(6)+1;
      floors=new Floor[floorCount];

      for(int i=0; i<floorCount; i++) {
         floors[i]=Floor.createInstance(source, this);
      }

      // read residue entries

      int residueCount=source.getInt(6)+1;
      residues=new Residue[residueCount];

      for(int i=0; i<residueCount; i++) {
         residues[i]=Residue.createInstance(source, this);
      }

      // read mapping entries

      int mappingCount=source.getInt(6)+1;
      mappings=new Mapping[mappingCount];

      for(int i=0; i<mappingCount; i++) {
         mappings[i]=Mapping.createInstance(vorbis, source, this);
      }

      // read mode entries

      int modeCount=source.getInt(6)+1;
      modes=new Mode[modeCount];

      for(int i=0; i<modeCount; i++) {
         modes[i]=new Mode(source, this);
      }

      if(!source.getBit()) {
         throw new VorbisFormatException("The setup header framing bit is incorrect.");
      }
   }