func (tr *Reader) State() ([]byte, error) {
	buf := new(bytes.Buffer)
	encoder := gob.NewEncoder(buf)

	if err := encoder.Encode(tr.pad); err != nil {
		return nil, err
	}

	encodeCurr := tr.curr != nil

	if err := encoder.Encode(encodeCurr); err != nil {
		return nil, err
	}

	if encodeCurr {
		var label string
		switch t := tr.curr.(type) {
		case *regFileReader:
			label = "rfr"
		case *sparseFileReader:
			label = "sfr"
		default:
			return nil, fmt.Errorf("unable to encode numBytesReader of type %T", t)
		}

		if err := encoder.Encode(label); err != nil {
			return nil, err
		}

		if err := encoder.Encode(tr.curr); err != nil {
			return nil, err
		}
	}

	return buf.Bytes(), nil
}
// State serializes the current state of the Tar Reader. This
// includes the current file entry position and block padding.
State serializes the current state of the Tar Reader. This
includes the current file entry position and block padding.
// State serializes the current state of the Tar Reader . This // includes the current file entry position and block padding .
func (tr *Reader) State() ([]byte, error) {
	buf := new(bytes.Buffer)
	encoder := gob.NewEncoder(buf)
	if err := encoder.Encode(tr.pad); err != nil {
		return nil, err
	}
	encodeCurr := tr.curr != nil
	if err := encoder.Encode(encodeCurr); err != nil {
		return nil, err
	}
	if encodeCurr {
		var label string
		switch t := tr.curr.(type) {
		case *regFileReader:
			label = "rfr"
		case *sparseFileReader:
			label = "sfr"
		default:
			return nil, fmt.Errorf("unable to encode numBytesReader of type %T", t)
		}
		if err := encoder.Encode(label); err != nil {
			return nil, err
		}
		if err := encoder.Encode(tr.curr); err != nil {
			return nil, err
		}
	}
	return buf.Bytes(), nil
}
func ( tr * Reader ) State ( ) ( [ ] byte , error ) { buf := new ( bytes . Buffer ) encoder := gob . NewEncoder ( buf ) if err := encoder . Encode ( tr . pad ) ; err != nil { return nil , err } encodeCurr := tr . curr != nil if err := encoder . Encode ( encodeCurr ) ; err != nil { return nil , err } if encodeCurr { var label string switch t := tr . curr . ( type ) { case * regFileReader : label = " " case * sparseFileReader : label = " " default : return nil , fmt . Errorf ( " " , t ) } if err := encoder . Encode ( label ) ; err != nil { return nil , err } if err := encoder . Encode ( tr . curr ) ; err != nil { return nil , err } } return buf . Bytes ( ) , nil }
State serializes the current state of the Tar Reader.
State serializes the current state of the Tar Reader .