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:
java.io.Serializable
- Direct Known Subclasses:
InvalidProtocolBufferException.InvalidWireTypeException
public class InvalidProtocolBufferException extends java.io.IOExceptionThrown when a protocol message being parsed is invalid in some way. For instance, it contains a malformed varint or a negative byte length.- 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.
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDprivate MessageLiteunfinishedMessageprivate booleanwasThrownFromInputStream
-
Constructor Summary
Constructors Constructor Description InvalidProtocolBufferException(java.io.IOException e)InvalidProtocolBufferException(java.lang.Exception e)InvalidProtocolBufferException(java.lang.String description)InvalidProtocolBufferException(java.lang.String description, java.io.IOException e)InvalidProtocolBufferException(java.lang.String description, java.lang.Exception e)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleangetThrownFromInputStream()Allows code catching IOException from CodedInputStream to tell whether this instance was thrown by a delegate InputStream, rather than directly by a parse failure.MessageLitegetUnfinishedMessage()Returns the unfinished message attached to the exception, or null if no message is attached.(package private) static InvalidProtocolBufferExceptioninvalidEndTag()(package private) static InvalidProtocolBufferExceptioninvalidTag()(package private) static InvalidProtocolBufferExceptioninvalidUtf8()(package private) static InvalidProtocolBufferException.InvalidWireTypeExceptioninvalidWireType()(package private) static InvalidProtocolBufferExceptionmalformedVarint()(package private) static InvalidProtocolBufferExceptionnegativeSize()(package private) static InvalidProtocolBufferExceptionparseFailure()(package private) static InvalidProtocolBufferExceptionrecursionLimitExceeded()(package private) voidsetThrownFromInputStream()Set by CodedInputStreamInvalidProtocolBufferExceptionsetUnfinishedMessage(MessageLite unfinishedMessage)Attaches an unfinished message to the exception to support best-effort parsing inParserinterface.(package private) static InvalidProtocolBufferExceptionsizeLimitExceeded()(package private) static InvalidProtocolBufferExceptiontruncatedMessage()java.io.IOExceptionunwrapIOException()Unwraps the underlyingIOExceptionif this exception was caused by an I/O problem.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
unfinishedMessage
private MessageLite unfinishedMessage
-
wasThrownFromInputStream
private boolean wasThrownFromInputStream
-
-
Constructor Detail
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(java.lang.String description)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(java.lang.Exception e)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(java.lang.String description, java.lang.Exception e)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(java.io.IOException e)
-
InvalidProtocolBufferException
public InvalidProtocolBufferException(java.lang.String description, java.io.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.
-
setThrownFromInputStream
void setThrownFromInputStream()
Set by CodedInputStream
-
getThrownFromInputStream
boolean getThrownFromInputStream()
Allows code catching IOException from CodedInputStream to tell whether this instance was thrown by a delegate InputStream, rather than directly by a parse failure.
-
unwrapIOException
public java.io.IOException unwrapIOException()
Unwraps the underlyingIOExceptionif this exception was caused by an I/O problem. Otherwise, returnsthis.
-
truncatedMessage
static InvalidProtocolBufferException truncatedMessage()
-
negativeSize
static InvalidProtocolBufferException negativeSize()
-
malformedVarint
static InvalidProtocolBufferException malformedVarint()
-
invalidTag
static InvalidProtocolBufferException invalidTag()
-
invalidEndTag
static InvalidProtocolBufferException invalidEndTag()
-
invalidWireType
static InvalidProtocolBufferException.InvalidWireTypeException invalidWireType()
-
recursionLimitExceeded
static InvalidProtocolBufferException recursionLimitExceeded()
-
sizeLimitExceeded
static InvalidProtocolBufferException sizeLimitExceeded()
-
parseFailure
static InvalidProtocolBufferException parseFailure()
-
invalidUtf8
static InvalidProtocolBufferException invalidUtf8()
-
-