Package com.google.protobuf
Class InvalidProtocolBufferException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- com.google.protobuf.InvalidProtocolBufferException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
InvalidProtocolBufferException.InvalidWireTypeException
public class InvalidProtocolBufferException extends IOException
Thrown when a protocol message being parsed is invalid in some way. For instance, it contains a malformed varint or a negative byte length.- Author:
- kenton@google.com Kenton Varda
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInvalidProtocolBufferException.InvalidWireTypeExceptionException indicating that an unexpected wire type was encountered for a field.
-
Constructor Summary
Constructors Constructor Description InvalidProtocolBufferException(IOException e)InvalidProtocolBufferException(Exception e)InvalidProtocolBufferException(String description)InvalidProtocolBufferException(String description, IOException e)InvalidProtocolBufferException(String description, Exception e)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MessageLitegetUnfinishedMessage()Returns the unfinished message attached to the exception, or null if no message is attached.InvalidProtocolBufferExceptionsetUnfinishedMessage(MessageLite unfinishedMessage)Attaches an unfinished message to the exception to support best-effort parsing inParserinterface.IOExceptionunwrapIOException()Unwraps the underlyingIOExceptionif 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
-
-
-
-
Constructor Detail
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(String description)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(Exception e)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(String description, Exception e)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(IOException e)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(String description, IOException e)
-
-
Method Detail
-
setUnfinishedMessage
public InvalidProtocolBufferException setUnfinishedMessage(MessageLite unfinishedMessage)
Attaches an unfinished message to the exception to support best-effort parsing inParserinterface.- Returns:
- this
-
getUnfinishedMessage
public MessageLite getUnfinishedMessage()
Returns the unfinished message attached to the exception, or null if no message is attached.
-
unwrapIOException
public IOException unwrapIOException()
Unwraps the underlyingIOExceptionif this exception was caused by an I/O problem. Otherwise, returnsthis.
-
-