truncate
truncate(newLength: Integer64) updating;
The truncate method of the JadeBytes class truncates the binary content of the receiver to the length specified by the value of the newLength parameter. The method uses the smallest number of segments and the smallest size of tail segment from the range of valid segment sizes, to provide the best fit for the truncated content.
If the value of the newLength parameter exceeds the current length of the content of the receiver, the method has no effect.
The following example shows the use of the truncate method.
vars bytes : JadeBytes; begin create bytes; bytes.setContent("JADEBYTES".Binary); bytes.truncate(4); write bytes.getContent; // Writes "JADE" epilog delete bytes; end;