  The variation of the electronic structure normal to 1D defects in
quasi-freestanding MoS$_2$, grown by molecular beam epitaxy, is investigated
through high resolution scanning tunneling spectroscopy at $5$K. Strong upwards
bending of valence and conduction bands towards the line defects is found for
the 4|4E mirror twin boundary and island edges, but not for the 4|4P mirror
twin boundary. Quantized energy levels in the valence band are observed
wherever upwards band bending takes place. Focusing on the common 4|4E mirror
twin boundary, density functional theory calculations give an estimate of its
charging, which agrees well with electrostatic modeling. We show that the line
charge can also be assessed from the filling of the boundary-localized
electronic band, whereby we provide a measurement of the theoretically
predicted quantized polarization charge at MoS$_2$ mirror twin boundaries.
These calculations elucidate the origin of band bending and charging at these
1D defects in MoS$_2$. The 4|4E mirror twin boundary not only impairs charge
transport of electrons and holes due to band bending, but holes are
additionally subject to a potential barrier, which is inferred from the
independence of the quantized energy landscape on either side of the boundary.
