static public byte [ ] expandByteArray ( byte [ ] src , byte b ) { int srcLength = ( null != src ) ? src . length : 0 ; int totalLen = srcLength + 1 ; byte [ ] rc = new byte [ totalLen ] ; try { if ( null != src ) { System . arraycopy ( src , 0 , rc , 0 , srcLength ) ; } rc [ srcLength ] = b ; } catch ( Exception e ) { // no FFDC required // any error from arraycopy, we'll just return null if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Exception " + e + " while copying." ) ; } rc = null ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "expandByteArray returning: [" + getEnglishString ( rc ) + "]" ) ; } return rc ; }
Helper method to append a byte to a byte array .