public static DataChecksum newDataChecksum ( int type , int bytesPerChecksum , Checksum sum ) { if ( bytesPerChecksum <= 0 ) { return null ; } int checksumSize = getChecksumSizeByType ( type ) ; switch ( type ) { case CHECKSUM_NULL : return new DataChecksum ( CHECKSUM_NULL , new ChecksumNull ( ) , checksumSize , bytesPerChecksum ) ; case CHECKSUM_CRC32 : return new DataChecksum ( CHECKSUM_CRC32 , sum , checksumSize , bytesPerChecksum ) ; default : return null ; } }
This constructor uses the specified summer instance