I don't know how you can block an sms message before it is received.
However, reading a SMS via Android can be done after it is received can be done using a query on the SMS inbox. The SMSPopUp application for Android does this and more. The sourcecode of this application can be found here https://code.google.com/p/android-smspopup/
For example, look at the getSmsDetails method in the SMSPopUp application.