public static final IDataSegment create (final ByteBuffer buffer, final int position, final int length, final DataSegmentFormat format, final int maxChunkSize) {

        final IDataSegment dataSegment = DataSegmentFactory.create(format, maxChunkSize);
        dataSegment.setDataBuffer(buffer, position, length);

        return dataSegment;
    }
public static final IDataSegment create ( final ByteBuffer buffer , final int position , final int length , final DataSegmentFormat format , final int maxChunkSize ) { final IDataSegment dataSegment = DataSegmentFactory . create ( format , maxChunkSize ) ; dataSegment . setDataBuffer ( buffer , position , length ) ; return dataSegment ; }
Creates a data segment of the given format and with the given chunk size (in bytes). This data segment is
initialized with the data of <code>buffer</code>.

@param buffer The initialization buffer.
@param position The position of the variable <code>buffer</code>.
@param length The length (in bytes) to read from <code>buffer</code>.
@param format A format from the <code>DataSegmentFormat</code> enumeration.
@param maxChunkSize The size (in bytes) of one chunk, which represents the <code>MaxRecvDataSegmentLength</code>
.
@return The instance of an <codE>DataSegment</code> object.