Appends data to data that can be read from the input stream
data
a MemoryInputStream
input data
function that is called to free data, or null
length of the data, may be -1 if data is a nul-terminated string