com.google.protobuf

## Class InvalidProtocolBufferException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.io.IOException
      - - com.google.protobuf.InvalidProtocolBufferException

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    InvalidProtocolBufferException.InvalidWireTypeException

      public class InvalidProtocolBufferException
      extends java.io.IOException

  Thrown when a protocol message being parsed is invalid in some way, e.g. it contains a malformed varint or a negative byte length.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `InvalidProtocolBufferException.InvalidWireTypeException` Exception indicating that and unexpected wire type was encountered for a field.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InvalidProtocolBufferException(java.io.IOException e)`
    `InvalidProtocolBufferException(java.lang.String description)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MessageLite` | `getUnfinishedMessage()` Returns the unfinished message attached to the exception, or null if no message is attached.
    `InvalidProtocolBufferException` | `setUnfinishedMessage(MessageLite unfinishedMessage)` Attaches an unfinished message to the exception to support best-effort parsing in `Parser` interface.
    `java.io.IOException` | `unwrapIOException()` Unwraps the underlying `IOException` if this exception was caused by an I/O problem.

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### InvalidProtocolBufferException

          public InvalidProtocolBufferException(java.lang.String description)

    - #### InvalidProtocolBufferException

          public InvalidProtocolBufferException(java.io.IOException e)

  - ### Method Detail

    - #### setUnfinishedMessage

          public InvalidProtocolBufferException setUnfinishedMessage(MessageLite unfinishedMessage)

      Attaches an unfinished message to the exception to support best-effort parsing in `Parser` interface.
      Returns:
        this

    - #### getUnfinishedMessage

          public MessageLite getUnfinishedMessage()

      Returns the unfinished message attached to the exception, or null if no message is attached.

    - #### unwrapIOException

          public java.io.IOException unwrapIOException()

      Unwraps the underlying `IOException` if this exception was caused by an I/O problem. Otherwise, returns `this`.