Logo Search packages:      
Sourcecode: jhdf version File versions  Download package

void ncsa::hdf::object::h5::H5ScalarDS::setName ( String  newName  )  throws Exception [inline]

Sets the name of the object.

setName (String newName) changes the name of the object in the file.

newName The new name of the object.

Reimplemented from ncsa::hdf::object::HObject.

Definition at line 1220 of file H5ScalarDS.java.

References ncsa::hdf::object::HObject::getFID(), ncsa::hdf::object::HObject::getName(), and ncsa::hdf::object::HObject::getPath().

Referenced by test::unittests::H5ScalarDSTest::testSetName().

        String currentFullPath = this.getPath()+this.getName();
        String newFullPath = this.getPath()+newName;
        currentFullPath = currentFullPath.replaceAll("//", "/");
        newFullPath = newFullPath.replaceAll("//", "/");

        if ( currentFullPath.equals("/") ) {
            throw new HDF5Exception( "Can't rename the root group." );
        if ( currentFullPath.equals(newFullPath) ) {
            throw new HDF5Exception( 
                "The new name is the same as the current name." );
        // Call the library to move things in the file
        H5.H5Gmove(this.getFID(), currentFullPath, newFullPath);


Generated by  Doxygen 1.6.0   Back to index