As long as you sanitize it completely, then yes. The whole point behind a separate reading is just extra precaution, especially for those with less than ideal sanitation techniques. In fact, I have done direct gravity readings multiple times when I don't feel like tasting the brew at the moment (which is only after I just brushed my teeth).
In fact, when I have my brew in the secondary I often prefer direct readings. Its less work and trouble to just sanitize the hydrometer and place it directly in the fermenting vessel for analysis versus sanitizing a container and removing liquid that will end up lowering the level because I almost never put back in what I take out...its just too tempting to taste!