Overload write?

write(io::IO, x)                                                                                                                                                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                     
  Write the canonical binary representation of a value to the given I/O stream or file.

I would like to use this for my own I/O, something like

struct MyIO <: IO
    handle::Ptr{Cvoid}
    ...    
end

myio = MyIO(...)
write(myio, whatevervalue)

Which methods does write call, that I would have to provide for MyIO?

https://docs.julialang.org/en/v1/base/io-network/#Base.unsafe_read
https://docs.julialang.org/en/v1/base/io-network/#Base.unsafe_write

According to the documentation:

It is recommended that subtypes T<:IO override the following method signature to provide more efficient implementations: unsafe_read(s::T, p::Ptr{UInt8}, n::UInt)