Wrapper

In computer science, a wrapper is any entity that encapsulates (wraps around) another item. Wrappers are used for two primary purposes: to convert data to a compatible format or to hide the complexity of the underlying entity using abstraction. Examples include object wrappers, function wrappers, and driver wrappers.

1. Object Wrapper

An object wrapper is a class that encapsulates a primitive data type or another object. It may be used in Java, for example, to convert a char primitive to a character class. By converting the primitive to a class, a developer can use a method, such as toUpperCase() to modify the data. An object wrapper may also be used to convert the properties of a legacy class to ones that are compatible with newer code.

2. Function Wrapper

A function wrapper encapsulates one or more functions. For example, a website's "send mail" function may wrap multiple functions that process form data, check the submission for spam, and send the message using a mail server. A function wrapper may also wrap a single function to allow it to work with newer or older code. For example, it may change or add parameters to make a function compatible with a newer API.

3. Driver Wrapper

A driver wrapper allows a driver to function with an otherwise incompatible operating system. For example, an older graphics card may only support drivers designed for Windows 7. If a Windows 10 driver is not available, a driver wrapper may serve as an adapter, allowing the graphics card to use the Windows 7 driver in Windows 10. Driver wrappers may be provided by either the original equipment manufacturer (OEM) or a third-party developer.

Updated August 6, 2019 by Per C.

quizTest Your Knowledge

Which of the following is not a design pattern associated with object-oriented programming?

A
Creational pattern
0%
B
Intrinsic pattern
0%
C
Structural pattern
0%
D
Behavioral pattern
0%
Correct! Incorrect!     View the Design Pattern definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of Wrapper on this page is an original definition written by the TechTerms.com team. If you would like to reference this page or cite this definition, please use the green citation links above.

The goal of TechTerms.com is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.