Pulsar timing arrays (PTAs) can be used to search for very low frequency (10−9–10−7 Hz) gravitational waves (GWs). In this paper, we present a general method for the detection and localization of single-source GWs using PTAs. We demonstrate the effectiveness of this new method for three types of signals: monochromatic waves as expected from individual supermassive binary black holes in circular orbits, GWs from eccentric binaries and GW bursts. We also test its implementation in realistic data sets that include effects such as uneven sampling and heterogeneous data spans and measurement precision. It is shown that our method, which works in the frequency domain, performs as well as published time-domain methods. In particular, we find it equivalent to the Fe-statistic for monochromatic waves. We also discuss the construction of null streams – data streams that have null response to GWs, and the prospect of using null streams as a consistency check in the case of detected GW signals. Finally, we present sensitivities to individual supermassive binary black holes in eccentric orbits. We find that a monochromatic search that is designed for circular binaries can efficiently detect eccentric binaries with both high and low eccentricities, while a harmonic summing technique provides greater sensitivities only for binaries with moderate eccentricities.