Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2025-11-11 The HDF5 Field Guide

- Main Page
- Getting started
- User Guide
- Reference Manual
- Cookbook
- Technical Notes
- RFCs
- Specifications
- Glossary
- Full-Text Search
- About

Loading...
Searching...
No Matches
Functions
Java Group (H5G) Interface

## Detailed Description

See also
  Groups (H5G), C-API
  HDF5 Groups, User Guide

## Functions
static int | H5Gclose (long group_id) throws HDF5LibraryException
static long | H5Gcreate (long loc_id, String name, long lcpl_id, long gcpl_id, long gapl_id) throws HDF5LibraryException, NullPointerException
static long | H5Gcreate_anon (long loc_id, long gcpl_id, long gapl_id) throws HDF5LibraryException
static synchronized native void | H5Gflush (long group_id) throws HDF5LibraryException
static synchronized native long | H5Gget_create_plist (long group_id) throws HDF5LibraryException
static synchronized native H5G_info_t | H5Gget_info (long group_id) throws HDF5LibraryException
static synchronized native H5G_info_t | H5Gget_info_by_idx (long group_id, String group_name, int idx_type, int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException
static synchronized native H5G_info_t | H5Gget_info_by_name (long group_id, String name, long lapl_id) throws HDF5LibraryException, NullPointerException
static synchronized int | H5Gget_obj_info_all (long loc_id, String name, String[] objNames, int[] objTypes, H5O_token_t[] tokens) throws HDF5LibraryException, NullPointerException
static synchronized int | H5Gget_obj_info_all (long loc_id, String name, String[] objNames, int[] objTypes, int[] ltype, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException
static synchronized int | H5Gget_obj_info_all (long loc_id, String name, String[] objNames, int[] objTypes, int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException
static synchronized int | H5Gget_obj_info_full (long loc_id, String name, String[] objNames, int[] objTypes, int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type, int indx_order) throws HDF5LibraryException, NullPointerException
static synchronized int | H5Gget_obj_info_idx (long loc_id, String name, int idx, String[] oname, int[] type) throws HDF5LibraryException, NullPointerException
static synchronized int | H5Gget_obj_info_max (long loc_id, String[] objNames, int[] objTypes, int[] lnkTypes, H5O_token_t[] objToken, long objMax) throws HDF5LibraryException, NullPointerException
static synchronized long | H5Gn_members (long loc_id, String name) throws HDF5LibraryException, NullPointerException
static long | H5Gopen (long loc_id, String name, long gapl_id) throws HDF5LibraryException, NullPointerException
static synchronized native void | H5Grefresh (long group_id) throws HDF5LibraryException

## Function Documentation

## ◆ H5Gclose()

static int H5Gclose | ( | long | group_id | ) | throws HDF5LibraryException
| static

H5Gclose releases resources used by a group which was opened by a call to H5Gcreate() or H5Gopen().

Parameters

  group_id | Group identifier to release.

Returns
  a non-negative value if successful

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.

## ◆ H5Gcreate()

static long H5Gcreate | ( | long | loc_id,
|  | String | name,
|  | long | lcpl_id,
|  | long | gcpl_id,
|  | long | gapl_id ) throws HDF5LibraryException, NullPointerException
| static

H5Gcreate creates a new group with the specified name at the specified location, loc_id.

Parameters

  loc_id | IN: The file or group identifier.
  name | IN: The absolute or relative name of the new group.
  lcpl_id | IN: Identifier of link creation property list.
  gcpl_id | IN: Identifier of group creation property list.
  gapl_id | IN: Identifier of group access property list. (No group access properties have been implemented at this time; use H5P_DEFAULT.)

Returns
  a valid group identifier

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gcreate_anon()

static long H5Gcreate_anon | ( | long | loc_id,
|  | long | gcpl_id,
|  | long | gapl_id ) throws HDF5LibraryException
| static

H5Gcreate_anon creates a new empty group in the file specified by loc_id.

Parameters

  loc_id | IN: File or group identifier specifying the file in which the new group is to be created.
  gcpl_id | IN: Identifier of group creation property list.
  gapl_id | IN: Identifier of group access property list. (No group access properties have been implemented at this time; use H5P_DEFAULT.)

Returns
  a valid group identifier

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.

## ◆ H5Gflush()

static synchronized native void H5Gflush | ( | long | group_id | ) | throws HDF5LibraryException
| static

H5Gflush causes all buffers associated with a group to be immediately flushed to disk without removing the data from the cache.

Parameters

  group_id | IN: Identifier of the group to be flushed.

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.

## ◆ H5Gget_create_plist()

static synchronized native long H5Gget_create_plist | ( | long | group_id | ) | throws HDF5LibraryException
| static

H5Gget_create_plist returns an identifier for the group creation property list associated with the group specified by group_id.

Parameters

  group_id | IN: Identifier of the group.

Returns
  an identifier for the group's creation property list

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.

## ◆ H5Gget_info()

static synchronized native H5G_info_t H5Gget_info | ( | long | group_id | ) | throws HDF5LibraryException
| static

H5Gget_info retrieves information about the group specified by group_id. The information is returned in the group_info struct.

Parameters

  group_id | IN: Identifier of the group.

Returns
  a structure in which group information is returned

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.

## ◆ H5Gget_info_by_idx()

static synchronized native H5G_info_t H5Gget_info_by_idx | ( | long | group_id,
|  | String | group_name,
|  | int | idx_type,
|  | int | order,
|  | long | n,
|  | long | lapl_id ) throws HDF5LibraryException, NullPointerException
| static

H5Gget_info_by_idx retrieves information about a group, according to the group's position within an index.

Parameters

  group_id | IN: File or group identifier.
  group_name | IN: Name of group for which information is to be retrieved.
  idx_type | IN: Type of index by which objects are ordered
  order | IN: Order of iteration within index
  n | IN: Attribute's position in index
  lapl_id | IN: Link access property list.

Returns
  a structure in which group information is returned

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gget_info_by_name()

static synchronized native H5G_info_t H5Gget_info_by_name | ( | long | group_id,
|  | String | name,
|  | long | lapl_id ) throws HDF5LibraryException, NullPointerException
| static

H5Gget_info_by_name retrieves information about the group group_name located in the file or group specified by loc_id.

Parameters

  group_id | IN: File or group identifier.
  name | IN: Name of group for which information is to be retrieved.
  lapl_id | IN: Link access property list.

Returns
  a structure in which group information is returned

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gget_obj_info_all() [1/3]

static synchronized int H5Gget_obj_info_all | ( | long | loc_id,
|  | String | name,
|  | String[] | objNames,
|  | int[] | objTypes,
|  | H5O_token_t[] | tokens ) throws HDF5LibraryException, NullPointerException
| static

retrieves information of all objects under the group (name) located in the file or group specified by loc_id.

Parameters

  loc_id | IN: File or group identifier
  name | IN: Name of group for which information is to be retrieved
  objNames | OUT: Names of all objects under the group, name.
  objTypes | OUT: Types of all objects under the group, name.
  tokens | OUT: Object token of all objects under the group, name.

Returns
  the number of items found

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gget_obj_info_all() [2/3]

static synchronized int H5Gget_obj_info_all | ( | long | loc_id,
|  | String | name,
|  | String[] | objNames,
|  | int[] | objTypes,
|  | int[] | ltype,
|  | H5O_token_t[] | tokens,
|  | int | indx_type ) throws HDF5LibraryException, NullPointerException
| static

retrieves information of all objects under the group (name) located in the file or group specified by loc_id.

Parameters

  loc_id | IN: File or group identifier
  name | IN: Name of group for which information is to be retrieved
  objNames | OUT: Names of all objects under the group, name.
  objTypes | OUT: Types of all objects under the group, name.
  ltype | OUT: Link type
  tokens | OUT: Object token of all objects under the group, name.
  indx_type | IN: Index type for iterate

Returns
  the number of items found

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gget_obj_info_all() [3/3]

static synchronized int H5Gget_obj_info_all | ( | long | loc_id,
|  | String | name,
|  | String[] | objNames,
|  | int[] | objTypes,
|  | int[] | ltype,
|  | long[] | fno,
|  | H5O_token_t[] | tokens,
|  | int | indx_type ) throws HDF5LibraryException, NullPointerException
| static

retrieves information of all objects under the group (name) located in the file or group specified by loc_id.

Parameters

  loc_id | IN: File or group identifier
  name | IN: Name of group for which information is to be retrieved
  objNames | OUT: Names of all objects under the group, name.
  objTypes | OUT: Types of all objects under the group, name.
  ltype | OUT: Link type
  fno | OUT: File number
  tokens | OUT: Object token of all objects under the group, name.
  indx_type | IN: Index type for iterate

Returns
  the number of items found

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gget_obj_info_full()

static synchronized int H5Gget_obj_info_full | ( | long | loc_id,
|  | String | name,
|  | String[] | objNames,
|  | int[] | objTypes,
|  | int[] | ltype,
|  | long[] | fno,
|  | H5O_token_t[] | tokens,
|  | int | indx_type,
|  | int | indx_order ) throws HDF5LibraryException, NullPointerException
| static

retrieves information of all objects under the group (name) located in the file or group specified by loc_id.

Parameters

  loc_id | IN: File or group identifier
  name | IN: Name of group for which information is to be retrieved
  objNames | OUT: Names of all objects under the group, name.
  objTypes | OUT: Types of all objects under the group, name.
  ltype | OUT: Link type
  fno | OUT: File number
  tokens | OUT: Object token of all objects under the group, name.
  indx_type | IN: Index type for iterate
  indx_order | IN: Index order for iterate

Returns
  the number of items found

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gget_obj_info_idx()

static synchronized int H5Gget_obj_info_idx | ( | long | loc_id,
|  | String | name,
|  | int | idx,
|  | String[] | oname,
|  | int[] | type ) throws HDF5LibraryException, NullPointerException
| static

H5Gget_obj_info_idx report the name and type of object with index 'idx' in a Group. The 'idx' corresponds to the index maintained by H5Giterate. Each link is returned, so objects with multiple links will be counted once for each link.

Parameters

  loc_id | IN: file or group ID.
  name | IN: name of the group to iterate, relative to the loc_id
  idx | IN: the index of the object to iterate.
  oname | OUT: the name of the object
  type | OUT: the type of the object

Returns
  non-negative if successful, -1 if not.

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gget_obj_info_max()

static synchronized int H5Gget_obj_info_max | ( | long | loc_id,
|  | String[] | objNames,
|  | int[] | objTypes,
|  | int[] | lnkTypes,
|  | H5O_token_t[] | objToken,
|  | long | objMax ) throws HDF5LibraryException, NullPointerException
| static

retrieves information of all objects (recurvisely) under the group (name) located in the file or group specified by loc_id up to maximum specified by objMax.

Parameters

  loc_id | IN: File or group identifier
  objNames | OUT: Names of all objects under the group, name.
  objTypes | OUT: Types of all objects under the group, name.
  lnkTypes | OUT: Types of all links under the group, name.
  objToken | OUT: Object token of all objects under the group, name.
  objMax | IN: Maximum number of all objects under the group, name.

Returns
  the number of items found

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gn_members()

static synchronized long H5Gn_members | ( | long | loc_id,
|  | String | name ) throws HDF5LibraryException, NullPointerException
| static

H5Gn_members report the number of objects in a Group. The 'objects' include everything that will be visited by H5Giterate. Each link is returned, so objects with multiple links will be counted once for each link.

Parameters

  loc_id | file or group ID.
  name | name of the group to iterate, relative to the loc_id

Returns
  the number of members in the group or -1 if error.

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Gopen()

static long H5Gopen | ( | long | loc_id,
|  | String | name,
|  | long | gapl_id ) throws HDF5LibraryException, NullPointerException
| static

H5Gopen opens an existing group, name, at the location specified by loc_id.

Parameters

  loc_id | IN: File or group identifier specifying the location of the group to be opened.
  name | IN: Name of group to open.
  gapl_id | IN: Identifier of group access property list.

Returns
  a valid group identifier if successful

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.
  NullPointerException | name is null.

## ◆ H5Grefresh()

static synchronized native void H5Grefresh | ( | long | group_id | ) | throws HDF5LibraryException
| static

H5Grefresh causes all buffers associated with a group to be cleared and immediately re-loaded with updated contents from disk. This function essentially closes the group, evicts all metadata associated with it from the cache, and then re-opens the group. The reopened group is automatically re-registered with the same ID.

Parameters

  group_id | IN: Identifier of the group to be refreshed.

Exceptions

  HDF5LibraryException | Error from the HDF5 Library.