Creates a copy of the given buffer. This will make a newly allocated copy of the data the source buffer contains.
a new copy of buf if the copy succeeded, null otherwise.
Creates a copy of the given buffer. This will make a newly allocated copy of the data the source buffer contains.