docs: private void readLayerAndMaskInfo(final boolean pParseData) throws IOException {
          readImageResources(false);
  
          if (pParseData && (metadata.layerInfo == null || metadata.globalLayerMask == null) || metadata.imageDataStart == 0) {
              imageInput.seek(metadata.layerAndMaskInfoStart);
  
              long layerAndMaskInfoLength = header.largeFormat ? imageInput.readLong() : imageInput.readUnsignedInt();
  
              // NOTE: The spec says that if this section is empty, the length should be 0.
              // Yet I have a PSB file that has size 12, and both contained lengths set to 0 (which
              // is alo not as per spec, as layer count should be included if there's a layer info
              // block, so minimum size should be either 0 or 14 (or 16 if multiple of 4 for PSB))...
  
              if (layerAndMaskInfoLength > 0) {
                  long pos = imageInput.getStreamPosition();
  
                  //if (metadata.layerInfo == null) {
                  long layerInfoLength = header.largeFormat ? imageInput.readLong() : imageInput.readUnsignedInt();
  
                  if (layerInfoLength > 0) {
                      // "Layer count. If it is a negative number, its absolute value is the number of
                      // layers and the first alpha channel contains the transparency data for the
                      // merged result."
                      int layerCount = imageInput.readShort();
                      metadata.layerCount = layerCount;
  
                      if (pParseData && metadata.layerInfo == null) {
                          PSDLayerInfo[] layerInfos = new PSDLayerInfo[Math.abs(layerCount)];
                          for (int i = 0; i < layerInfos.length; i++) {
                              layerInfos[i] = new PSDLayerInfo(header.largeFormat, imageInput);
                          }
  
                          metadata.layerInfo = Arrays.asList(layerInfos);
                          metadata.layersStart = imageInput.getStreamPosition();
  
                      }
  
                      long read = imageInput.getStreamPosition() - pos;
                      long diff = layerInfoLength - (read - (header.largeFormat ? 8 : 4)); // - 8 or 4 for the layerInfoLength field itself
  
                      imageInput.skipBytes(diff);
                  }
                  else {
                      metadata.layerInfo = Collections.emptyList();
                  }
  
  
                  // Global LayerMaskInfo (18 bytes or more..?)
                  // 4 (length), 2 (colorSpace), 8 (4 * 2 byte color components), 2 (opacity %), 1 (kind), variable (pad)
                  long globalLayerMaskInfoLength = imageInput.readUnsignedInt(); // NOTE: Not long for PSB!
  
                  if (globalLayerMaskInfoLength > 0) {
                      if (pParseData && metadata.globalLayerMask == null) {
                          metadata.globalLayerMask = new PSDGlobalLayerMask(imageInput, globalLayerMaskInfoLength);
                      }
                      // TODO: Else skip?
                  }
                  else {
                      metadata.globalLayerMask = PSDGlobalLayerMask.NULL_MASK;
                  }
  
                  // TODO: Parse "Additional layer information"
  
                  // TODO: We should now be able to flush input
  //                    imageInput.seek(metadata.layerAndMaskInfoStart + layerAndMaskInfoLength + (header.largeFormat ? 8 : 4));
  //                    imageInput.flushBefore(metadata.layerAndMaskInfoStart + layerAndMaskInfoLength + (header.largeFormat ? 8 : 4));
  
                  if (pParseData && DEBUG) {
                      System.out.println("layerInfo: " + metadata.layerInfo);
                      System.out.println("globalLayerMask: " + (metadata.globalLayerMask != PSDGlobalLayerMask.NULL_MASK ? metadata.globalLayerMask : null));
                  }
                  //}
              }
  
              metadata.imageDataStart = metadata.layerAndMaskInfoStart + layerAndMaskInfoLength + (header.largeFormat ? 8 : 4);
          }
      }