private ImageInputStream getOrCreateImageInputStream(Band band, File file) throws IOException {
   ImageInputStream inputStream = getImageInputStream(band);
   if (inputStream == null) {
     try {
       inputStream = new FileImageInputStream(file);
     } catch (IOException e) {
       SystemUtils.LOG.log(
           Level.WARNING,
           "DimapProductReader: Unable to read file '"
               + file
               + "' referenced by '"
               + band.getName()
               + "'.",
           e);
     }
     if (inputStream == null) {
       return null;
     }
     if (bandInputStreams == null) {
       bandInputStreams = new Hashtable<Band, ImageInputStream>();
     }
     bandInputStreams.put(band, inputStream);
   }
   return inputStream;
 }
  private static int getGeoKeyAsInt(final int key, final GeoTiffIIOMetadataDecoder metadata) {

    try {
      return Integer.parseInt(metadata.getGeoKey(key));
    } catch (NumberFormatException ne) {
      SystemUtils.LOG.log(Level.FINE, ne.getMessage(), ne);
      return GeoTiffConstants.UNDEFINED;
    }
  }
  private void addVectorDataToProduct(File vectorFile, final CoordinateReferenceSystem modelCrs)
      throws IOException {
    FileReader reader = null;
    try {
      reader = new FileReader(vectorFile);
      FeatureUtils.FeatureCrsProvider crsProvider =
          new FeatureUtils.FeatureCrsProvider() {
            @Override
            public CoordinateReferenceSystem getFeatureCrs(Product product) {
              return modelCrs;
            }

            @Override
            public boolean clipToProductBounds() {
              return false;
            }
          };
      OptimalPlacemarkDescriptorProvider descriptorProvider =
          new OptimalPlacemarkDescriptorProvider();
      VectorDataNode vectorDataNode =
          VectorDataNodeReader.read(
              vectorFile.getName(),
              reader,
              product,
              crsProvider,
              descriptorProvider,
              modelCrs,
              VectorDataNodeIO.DEFAULT_DELIMITER_CHAR,
              ProgressMonitor.NULL);
      if (vectorDataNode != null) {
        final ProductNodeGroup<VectorDataNode> vectorDataGroup = product.getVectorDataGroup();
        final VectorDataNode existing = vectorDataGroup.get(vectorDataNode.getName());
        if (existing != null) {
          vectorDataGroup.remove(existing);
        }
        vectorDataGroup.add(vectorDataNode);
      }
    } catch (IOException e) {
      SystemUtils.LOG.log(Level.SEVERE, "Error reading '" + vectorFile + "'", e);
    } finally {
      if (reader != null) {
        reader.close();
      }
    }
  }