Which kind of contraceptive methods prevents STDs and how?

(a) Barrier method.
(b)Because by this method there is no direct contact of genital organs of male and female and thus it prevents transmission of any infection.