• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HDF5Exception类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ncsa.hdf.hdf5lib.exceptions.HDF5Exception的典型用法代码示例。如果您正苦于以下问题:Java HDF5Exception类的具体用法?Java HDF5Exception怎么用?Java HDF5Exception使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HDF5Exception类属于ncsa.hdf.hdf5lib.exceptions包,在下文中一共展示了HDF5Exception类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readExchangeSymbolQuotes

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
private void readExchangeSymbolQuotes(String exchange, String symbol) throws EodDataSinkException {
  

  openQuoteDataset(exchange, symbol);

  try {
  int fileDataspaceHandle = H5.H5Dget_space(quoteDatasetHandle);
  long dimensions[] = new long[1];
  long maxDimensions[] = new long[1];
  @SuppressWarnings("unused")
  int status = H5.H5Sget_simple_extent_dims(fileDataspaceHandle, dimensions, maxDimensions);
  
  final byte[] readBuffer = new byte[Hdf5QuoteDatatype.QUOTE_DATATYPE_SIZE * (int)dimensions[0]];

  H5.H5Dread(quoteDatasetHandle,
             HDF5Constants.H5T_NATIVE_INT,
             HDF5Constants.H5S_ALL,
             HDF5Constants.H5S_ALL,
             HDF5Constants.H5P_DEFAULT,
             readBuffer);
  }
  catch (HDF5Exception e) {
    throw new EodDataSinkException();
  }

}
 
开发者ID:jsr38,项目名称:ds3,代码行数:27,代码来源:HdfObjectEodDataSink.java


示例2: close

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
void close() throws EodDataSinkException {

    try {

      // TODO: this is really quite unsatisfactory as
      // an exception thrown from any of these calls
      // will mean any subsequent calls will not
      // be executed.
      H5.H5Tclose(codeDatatypeHandle);
      H5.H5Tclose(nameDatatypeHandle);
      H5.H5Tclose(countryDatatypeHandle);
      H5.H5Tclose(currencyDatatypeHandle);
      H5.H5Tclose(suffixDatatypeHandle);
      H5.H5Tclose(timezoneDatatypeHandle);
      H5.H5Tclose(isIntradayDatatypeHandle);
      H5.H5Tclose(intradayStartDateDatatypeHandle);
      H5.H5Tclose(hasIntradayProductDatatypeHandle);
      H5.H5Tclose(exchangeDatatypeHandle);

    }
    catch (HDF5Exception ex) {
      logger.error(ex);
      throw new EodDataSinkException("Encountered problem while attempting to close exchange data types.");
    }
    
  }
 
开发者ID:jsr38,项目名称:ds3,代码行数:27,代码来源:Hdf5ExchangeDatatype.java


示例3: makeDataset

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
/**
 * General dataset making recipe.
 * @param fullPath the dataset full path.
 * @param typeIdSupplier type id supplier lambda.
 * @param dimensions array with the dimensions of the data.
 * @param data the data. It must be an array of the appropriate type given the type that is
 *             going to be returned by the {@code typeIdSupplier}.
 * @return true iff the data-set needed to be created (it did not existed previously). It will
 * return false if the data-set existed even if it was modified in the process.
 */
private boolean makeDataset(final String fullPath, final IntSupplier typeIdSupplier, final long[] dimensions, final Object data) {
    checkCanWrite();
    int typeCopyId = -1;
    try {
        typeCopyId = typeIdSupplier.getAsInt();
        final Pair<String, String> pathAndName = splitPathInParentAndName(fullPath);
        final String groupPath = pathAndName.getLeft();
        final String dataSetName = pathAndName.getRight();
        makeGroup(groupPath);
        final int childType = findOutGroupChildType(groupPath, dataSetName, fullPath);
        if (childType == HDF5Constants.H5G_UNKNOWN) {
            createDataset(fullPath, typeCopyId, dimensions);
            writeDataset(fullPath, typeCopyId, data);
            return true;
        } else if (childType == HDF5Constants.H5G_DATASET) {
            writeDataset(fullPath, typeCopyId, data);
            return false;
        } else {
            throw new HDF5LibException(String.format("problem trying to write dataset %s in file %s: there is a collision with a non-dataset object", fullPath, file));
        }
    } finally {
        if (typeCopyId != -1) { try { H5.H5Tclose(typeCopyId); } catch (final HDF5Exception ex ){} }
    }
}
 
开发者ID:broadinstitute,项目名称:hdf5-java-bindings,代码行数:35,代码来源:HDF5File.java


示例4: dispose

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
@Override
 public void dispose(){
 	super.dispose();
 	if(h5file!=null){
 		try {
	h5file.close();
  		h5file=null;
} catch (HDF5Exception e) {
}
 	}
 	if(imagedata!=null){
 		imagedata.close(0);
 		imagedata=null;
 	}
 }
 
开发者ID:ec-europa,项目名称:sumo,代码行数:16,代码来源:AbstractCosmoSkymedImage.java


示例5: hdf5_close

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
/**
 * Closes the HDF5 file.
 * Function usefull only because of the try/catch
 */
public static void hdf5_close(H5File h5)
{
    try {
        h5.close();
    } catch (HDF5Exception ex) {
        System.out.println("Could not close HDF5 file?");
        ex.printStackTrace();
    }
}
 
开发者ID:jcdvorchak,项目名称:million-song-analysis,代码行数:14,代码来源:hdf5_getters.java


示例6: createExchangeDataset

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
private synchronized void createExchangeDataset(long dimension)
		throws HDF5Exception, EodDataSinkException {

	if (!isOpen) {
		throw new EodDataSinkException("HDF5 File data sink closed!");
	}

	long dimensions[] = { dimension };
	long maxDimensions[] = { HDF5Constants.H5S_UNLIMITED };
	int exchangeDataspaceHandle = H5.H5Screate_simple(
			EXCHANGE_DATASET_RANK, dimensions, maxDimensions);

	Hdf5ExchangeDatatype exchangeDatatype = new Hdf5ExchangeDatatype();
	exchangeDatatypeHandle = exchangeDatatype.getFileDatatypeHandle();

	int createProperties = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
	@SuppressWarnings("unused")
	int status = H5.H5Pset_chunk(createProperties, EXCHANGE_DATASET_RANK,
			dimensions);

	if ((fileHandle >= 0) && (exchangeDataspaceHandle >= 0)
			&& (exchangeDatatypeHandle >= 0)) {

		exchangeDatasetHandle = H5.H5Dcreate(fileHandle,
				EXCHANGE_DATASET_NAME, exchangeDatatypeHandle,
				exchangeDataspaceHandle, HDF5Constants.H5P_DEFAULT,
				createProperties, HDF5Constants.H5P_DEFAULT);
	} else {
		throw new EodDataSinkException(
				"Failed to create exchange dataset from scratch.");
	}

	logger.info("Sucessfully created new exchange dataset.");

}
 
开发者ID:jsr38,项目名称:ds3,代码行数:36,代码来源:Hdf5EodDataSink.java


示例7: createExchangeDataset

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
private void createExchangeDataset(long dimension) throws HDF5Exception, EodDataSinkException {

  long dimensions[] = { dimension };
  long maxDimensions[] = { HDF5Constants.H5S_UNLIMITED };
  int exchangeDataspaceHandle = H5.H5Screate_simple(EXCHANGE_DATASET_RANK, dimensions, maxDimensions);

  Hdf5ExchangeDatatype exchangeDatatype = new Hdf5ExchangeDatatype();
  exchangeDatatypeHandle = exchangeDatatype.getFileDatatypeHandle();

  int createProperties = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
  @SuppressWarnings("unused")
  int status = H5.H5Pset_chunk(createProperties, EXCHANGE_DATASET_RANK, dimensions);

  if ((fileHandle >= 0)
      && (exchangeDataspaceHandle >= 0)
      && (exchangeDatatypeHandle >= 0)) {

    exchangeDatasetHandle = H5.H5Dcreate(fileHandle,
                                         EXCHANGE_DATASET_NAME,
                                         exchangeDatatypeHandle,
                                         exchangeDataspaceHandle,
                                         HDF5Constants.H5P_DEFAULT,
                                         createProperties,
                                         HDF5Constants.H5P_DEFAULT);
  }
  else {
    throw new EodDataSinkException("Failed to create exchange dataset from scratch.");
  }

  logger.info("Sucessfully created new exchange dataset.");

}
 
开发者ID:jsr38,项目名称:ds3,代码行数:33,代码来源:HdfObjectEodDataSink.java


示例8: hdf5_close

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
/**
 * Closes the HDF5 file. Function usefull only because of the try/catch
 */
public static void hdf5_close(H5File h5) {
    try {
        h5.close();
    } catch (HDF5Exception ex) {
        System.out.println("Could not close HDF5 file?");
        ex.printStackTrace();
    }
}
 
开发者ID:h20,项目名称:MusicBigData,代码行数:12,代码来源:HDF5Helper.java


示例9: createQuoteDataset

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
private void createQuoteDataset(long dimension, int locationHandle) throws HDF5Exception, EodDataSinkException {

  long dimensions[] = { dimension };
  long maxDimensions[] = { HDF5Constants.H5S_UNLIMITED };
  
  int quoteDataspaceHandle = H5.H5Screate_simple(QUOTE_DATASET_RANK, dimensions, maxDimensions);
  quoteFileDatatypeHandle = Hdf5QuoteDatatype.getFileDatatypeHandle();
  quoteMemoryDatatypeHandle = Hdf5QuoteDatatype.getMemoryDatatypeHandle();

  int createProperties = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE);
  @SuppressWarnings("unused")
  int status = H5.H5Pset_chunk(createProperties, QUOTE_DATASET_RANK, QUOTEDATASET_CHUNK_DIMENSIONS);

  if ((fileHandle >= 0)
      && (quoteDataspaceHandle >= 0)
      && (quoteFileDatatypeHandle >= 0)) {

    try {
      quoteDatasetHandle = H5.H5Dcreate(locationHandle,
                                        QUOTE_DATASET_NAME,
                                        quoteFileDatatypeHandle,
                                        quoteDataspaceHandle,
                                        HDF5Constants.H5P_DEFAULT,
                                        createProperties,
                                        HDF5Constants.H5P_DEFAULT);
    }
    catch (HDF5Exception e) {
      throw e;
    }
    finally {
      H5.H5Sclose(quoteDataspaceHandle);
    }
    
  }
  else {
    throw new EodDataSinkException("Failed to create exchange dataset from scratch.");
  }

  logger.info("Sucessfully created new quote dataset.");


}
 
开发者ID:jsr38,项目名称:ds3,代码行数:43,代码来源:HdfObjectEodDataSink.java


示例10: recursiveGetInfo

import ncsa.hdf.hdf5lib.exceptions.HDF5Exception; //导入依赖的package包/类
private void recursiveGetInfo(IHDF5Reader reader, HDF5LinkInformation link)
{
	List<HDF5LinkInformation> members = reader.object().getGroupMemberInformation(link.getPath(), true);
	//    DefaultMutableTreeNode node = new DefaultMutableTreeNode(link.getName());

	for (HDF5LinkInformation info : members)
	{
		IJ.log(info.getPath() + ":" + info.getType());
		switch (info.getType())
		{
		case DATASET:
			HDF5DataSetInformation dsInfo = reader.object().getDataSetInformation(info.getPath());
			HDF5DataTypeInformation dsType = dsInfo.getTypeInformation();

			String dimText = "";
			if( dsInfo.getRank() == 0) 
			{
				dimText ="1";
			}
			else
			{
				dimText += dsInfo.getDimensions()[0];
				for( int i = 1; i < dsInfo.getRank(); ++i)
				{
					dimText += "x" + dsInfo.getDimensions()[i];
				}
			}


			String typeText = HDF5ImageJ.dsInfoToTypeString(dsInfo);

			// try to read element_size_um attribute
			String element_size_um_text = "unknown";
			try {
				float[] element_size_um = reader.float32().getArrayAttr(info.getPath(), "element_size_um");
				element_size_um_text = "" + element_size_um[0] + "x" 
						+ element_size_um[1] + "x" + element_size_um[2];

			}     
			catch (HDF5Exception err) {
				IJ.log("Warning: Can't read attribute 'element_size_um' from dataset '" + info.getPath() + "':\n"
						+ err );
			} 

			IJ.log(info.getPath() + ":" + dsInfo);

			dataSets_.add( new DataSetInfo( info.getPath(), dimText, typeText, 
					element_size_um_text));


			break;
		case SOFT_LINK:
			IJ.log(info.getPath() + "     -> " + info.tryGetSymbolicLinkTarget());
			//      node.add(new DefaultMutableTreeNode(info.getName() + "     -> " + info.tryGetSymbolicLinkTarget()));

			break;
		case GROUP:
			recursiveGetInfo( reader, info);
			//        node.add( browse(reader,info));

			break;
		default:
			break;
		}
	}

}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:68,代码来源:HDF5_Reader_Vibez.java



注:本文中的ncsa.hdf.hdf5lib.exceptions.HDF5Exception类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FindTicketsInfo类代码示例发布时间:2022-05-22
下一篇:
Java MultiLineString类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap