package jx

import (
	
	
)

// Capture calls f and then rolls back to state before call.
func ( *Decoder) ( func( *Decoder) error) error {
	if  == nil {
		return nil
	}

	if .reader != nil {
		// TODO(tdakkota): May it be more efficient?
		var (
			          bytes.Buffer
			 = .streamOffset
		)
		 := io.TeeReader(.reader, &)
		defer func() {
			.reader = io.MultiReader(&, .reader)
			.streamOffset = 
		}()
		.reader = 
	}
	, ,  := .head, .tail, .depth
	 := ()
	.head, .tail, .depth = , , 
	return 
}