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.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.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InvalidProtocolBufferException.InvalidWireTypeException
Exception indicating that an unexpected wire type was encountered for a field.
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
private MessageLite
unfinishedMessage
private boolean
wasThrownFromInputStream
-
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) 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.MessageLite
getUnfinishedMessage()
Returns the unfinished message attached to the exception, or null if no message is attached.(package private) static InvalidProtocolBufferException
invalidEndTag()
(package private) static InvalidProtocolBufferException
invalidTag()
(package private) static InvalidProtocolBufferException
invalidUtf8()
(package private) static InvalidProtocolBufferException.InvalidWireTypeException
invalidWireType()
(package private) static InvalidProtocolBufferException
malformedVarint()
(package private) static InvalidProtocolBufferException
negativeSize()
(package private) static InvalidProtocolBufferException
parseFailure()
(package private) static InvalidProtocolBufferException
recursionLimitExceeded()
(package private) void
setThrownFromInputStream()
Set by CodedInputStreamInvalidProtocolBufferException
setUnfinishedMessage(MessageLite unfinishedMessage)
Attaches an unfinished message to the exception to support best-effort parsing inParser
interface.(package private) static InvalidProtocolBufferException
sizeLimitExceeded()
(package private) static InvalidProtocolBufferException
truncatedMessage()
java.io.IOException
unwrapIOException()
Unwraps the underlyingIOException
if 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 inParser
interface.- 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 underlyingIOException
if 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()
-
-