Package com.fasterxml.jackson.core.exc

# Class StreamWriteException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.fasterxml.jackson.core.JacksonException
com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.exc.StreamWriteException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `JsonGenerationException`

public abstract class StreamWriteException extends JsonProcessingException
Intermediate base class for all read-side streaming processing problems, including parsing and input value coercion problems.

Added in 2.13 to eventually replace `JsonGenerationException`.

Since:
  2.13
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected JsonGenerator`
`_processor`

### Fields inherited from class com.fasterxml.jackson.core.JsonProcessingException

`_location`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`StreamWriteException(String msg, JsonGenerator g)`
`protected`
`StreamWriteException(String msg, Throwable rootCause, JsonGenerator g)`
`protected`
`StreamWriteException(Throwable rootCause, JsonGenerator g)`

## Method Summary

Modifier and Type
Method
Description
`JsonGenerator`
`getProcessor()`
Method that allows accessing underlying processor that triggered this exception; typically either `JsonParser` or `JsonGenerator` for exceptions that originate from streaming API.
`abstract StreamWriteException`
`withGenerator(JsonGenerator g)`
Fluent method that may be used to assign originating `JsonGenerator`, to be accessed using `getProcessor()`.

### Methods inherited from class com.fasterxml.jackson.core.JsonProcessingException

`clearLocation, getLocation, getMessage, getMessageSuffix, getOriginalMessage, toString`

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

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

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

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

## Field Details

### _processor

protected transient JsonGenerator _processor

## Constructor Details

### StreamWriteException

protected StreamWriteException(Throwable rootCause, JsonGenerator g)

### StreamWriteException

protected StreamWriteException(String msg, JsonGenerator g)

### StreamWriteException

protected StreamWriteException(String msg, Throwable rootCause, JsonGenerator g)

## Method Details

### withGenerator

public abstract StreamWriteException withGenerator(JsonGenerator g)
Fluent method that may be used to assign originating `JsonGenerator`, to be accessed using `getProcessor()`.

Parameters:
  `g` - Generator to assign
Returns:
  This exception instance (to allow call chaining)

### getProcessor

public JsonGenerator getProcessor()
Description copied from class: `JsonProcessingException`
Method that allows accessing underlying processor that triggered this exception; typically either `JsonParser` or `JsonGenerator` for exceptions that originate from streaming API. Note that it is possible that `null` may be returned if code throwing exception either has no access to processor; or has not been retrofitted to set it; this means that caller needs to take care to check for nulls. Subtypes override this method with co-variant return type, for more type-safe access.

Overrides:
  `getProcessor` in class `JsonProcessingException`
Returns:
  Originating processor, if available; null if not.