Among all proposed structures for optical networks, the optical packet switching (OPS) scheme, due to its practical implementation of IPs in an optical configuration and the consequent advantages, is a prizeworthy candidate for being employed in metropolitan area network and local area network communication levels. One of the few problems frequently met using the OPS structure in the fiber-optics realm is the lack of optical buffers, thus deteriorating the system's flexibility and quality of service. For example, optical label switching networks that have been developed recently based on the generalized multiprotocol label switching protocol, profoundly suffer from this setback which is considered as a great hurdle in their evolution. In this paper, we first introduce the input and output buffer switching models while deducing their blocking probability formulations. Then, by utilizing codes in the OPS structure, we closely examine the potential of code and/or wavelength switching in packet switching networks and also determine their blocking probability. Due to close similarities between different scenarios, we present the prospect of virtual optical buffers using codes, which have close performance to input and output buffers in sight of block probability. The most significant distinction in using virtual buffers is the fact that due to their substantial nature, they happen to exhibit some error probability. However, on account of the advantageous features of codes, the simulated and formulated error probability for both coherent and noncoherent optical code division multiple access (OCDMA), such as Spectrally phase encoded OCDMA and optical orthogonal codes, using virtual buffers, tends to be negligible. Two main code and wavelength switching schemes are also brought to attention in this work, the intelligent and random methods. These scenarios demonstrate an even greater behavioral performance to that of the mere code switching scenario, leading into a more reliable adaptation of virtual buffers. In addition, simulations results happen to provide clear verifications to our analytical approach.