public void FinalizeContent( int lenPos ) {

		if (lenPos == Tag.Indefinite_Length) {
			
			this.write(0);
			this.write(0);
		} else {
			
			int length = this.pos - lenPos - 1;
			if (length <= 0x7F) {
				this.buffer[lenPos] = (byte) length;
			} else {

				int count;
				byte[] buf = new byte[4];
				if ((length & 0xFF000000) > 0) {
					buf[0] = (byte)((length >> 24) & 0xFF);
					buf[1] = (byte)((length >> 16) & 0xFF);
					buf[2] = (byte)((length >> 8) & 0xFF);
					buf[3] = (byte)(length & 0xFF);
					count = 4;
				} else if ((length & 0x00FF0000) > 0) {
					buf[0] = (byte)((length >> 16) & 0xFF);
					buf[1] = (byte)((length >> 8) & 0xFF);
					buf[2] = (byte)(length & 0xFF);
					count = 3;
				} else if ((length & 0x0000FF00) > 0) {
					buf[0] = (byte)((length >> 8) & 0xFF);
					buf[1] = (byte)(length & 0xFF);
					count = 2;
				} else {
					buf[0] = (byte)(length & 0xFF);
					count = 1;
				}
				
				this.checkIncreaseArray(count);
				System.arraycopy(this.buffer, lenPos + 1, this.buffer, lenPos + 1 + count, length);
				this.pos += count;
				this.buffer[lenPos] = (byte) (0x80 | count);
				for (int i1 = 0; i1 < count; i1++) {
					this.buffer[lenPos + i1 + 1] = buf[i1];
				}
			}
		}
	}
public void FinalizeContent ( int lenPos ) { if ( lenPos == Tag . Indefinite_Length ) { this . write ( 0 ) ; this . write ( 0 ) ; } else { int length = this . pos - lenPos - 1 ; if ( length <= 0x7F ) { this . buffer [ lenPos ] = ( byte ) length ; } else { int count ; byte [ ] buf = new byte [ 4 ] ; if ( ( length & 0xFF000000 ) > 0 ) { buf [ 0 ] = ( byte ) ( ( length > > 24 ) & 0xFF ) ; buf [ 1 ] = ( byte ) ( ( length > > 16 ) & 0xFF ) ; buf [ 2 ] = ( byte ) ( ( length > > 8 ) & 0xFF ) ; buf [ 3 ] = ( byte ) ( length & 0xFF ) ; count = 4 ; } else if ( ( length & 0x00FF0000 ) > 0 ) { buf [ 0 ] = ( byte ) ( ( length > > 16 ) & 0xFF ) ; buf [ 1 ] = ( byte ) ( ( length > > 8 ) & 0xFF ) ; buf [ 2 ] = ( byte ) ( length & 0xFF ) ; count = 3 ; } else if ( ( length & 0x0000FF00 ) > 0 ) { buf [ 0 ] = ( byte ) ( ( length > > 8 ) & 0xFF ) ; buf [ 1 ] = ( byte ) ( length & 0xFF ) ; count = 2 ; } else { buf [ 0 ] = ( byte ) ( length & 0xFF ) ; count = 1 ; } this . checkIncreaseArray ( count ) ; System . arraycopy ( this . buffer , lenPos + 1 , this . buffer , lenPos + 1 + count , length ) ; this . pos += count ; this . buffer [ lenPos ] = ( byte ) ( 0x80 | count ) ; for ( int i1 = 0 ; i1 < count ; i1 ++ ) { this . buffer [ lenPos + i1 + 1 ] = buf [ i1 ] ; } } } }
This method must be invoked after finishing the content writing

@param lenPos
This parameter is the the return value of the
StartContentDefiniteLength() or StartContentIndefiniteLength()
methods