# Class ProtoObjectParser (2.1.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.1.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.protobuf.ProtoObjectParser)
- [2.0.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/2.0.3/com.google.api.client.protobuf.ProtoObjectParser)
- [1.47.1](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.47.1/com.google.api.client.protobuf.ProtoObjectParser)
- [1.46.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.46.3/com.google.api.client.protobuf.ProtoObjectParser)
- [1.45.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.45.3/com.google.api.client.protobuf.ProtoObjectParser)
- [1.44.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.44.2/com.google.api.client.protobuf.ProtoObjectParser)
- [1.43.2](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.43.2/com.google.api.client.protobuf.ProtoObjectParser)
- [1.42.3](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.42.3/com.google.api.client.protobuf.ProtoObjectParser)
- [1.41.8](https://docs.cloud.google.com/java/docs/reference/google-http-client/1.41.8/com.google.api.client.protobuf.ProtoObjectParser)

    public class ProtoObjectParser implements ObjectParser

[Beta](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.Beta)   

Parses protocol buffer HTTP response content into a protocol buffer message.

Implementation is immutable and therefore thread-safe.

Data-classes are expected to extend MessageLite.

All Charset parameters are ignored for protocol buffers.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> ProtoObjectParser

## Implements

[ObjectParser](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.ObjectParser)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### ProtoObjectParser()

    public ProtoObjectParser()

## Methods

### \<T\>parseAndClose(InputStream in, Charset charset, Class\<T\> dataClass)

    public T <T>parseAndClose(InputStream in, Charset charset, Class<T> dataClass)

Parses the given input stream into a new instance of the the given data class of key/value
pairs and closes the input stream.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `in` | `https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html` |
| `charset` | `https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html` |
| `dataClass` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<T>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### \<T\>parseAndClose(Reader reader, Class\<T\> dataClass)

    public T <T>parseAndClose(Reader reader, Class<T> dataClass)

Parses the given reader into a new instance of the the given data class of key/value pairs and
closes the reader.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `reader` | `https://docs.oracle.com/javase/8/docs/api/java/io/Reader.html` |
| `dataClass` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html<T>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### parseAndClose(InputStream in, Charset charset, Type dataType)

    public Object parseAndClose(InputStream in, Charset charset, Type dataType)

Parses the given input stream into a new instance of the the given data type of key/value pairs
and closes the input stream.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `in` | `https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html` |
| `charset` | `https://docs.oracle.com/javase/8/docs/api/java/nio/charset/Charset.html` |
| `dataType` | `https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Type.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### parseAndClose(Reader reader, Type dataType)

    public Object parseAndClose(Reader reader, Type dataType)

Parses the given reader into a new instance of the the given data type of key/value pairs and
closes the reader.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `reader` | `https://docs.oracle.com/javase/8/docs/api/java/io/Reader.html` |
| `dataType` | `https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Type.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |