mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			494 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			494 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
 | 
						|
 | 
						|
package compressions
 | 
						|
 | 
						|
type BaseWriter struct {
 | 
						|
	pool *WriterPool
 | 
						|
 | 
						|
	isFinished bool
 | 
						|
}
 | 
						|
 | 
						|
func (this *BaseWriter) SetPool(pool *WriterPool) {
 | 
						|
	this.pool = pool
 | 
						|
}
 | 
						|
 | 
						|
func (this *BaseWriter) Finish(obj Writer) error {
 | 
						|
	err := obj.RawClose()
 | 
						|
	if err == nil && this.pool != nil && !this.isFinished {
 | 
						|
		this.pool.Put(obj)
 | 
						|
	}
 | 
						|
	this.isFinished = true
 | 
						|
	return err
 | 
						|
}
 | 
						|
 | 
						|
func (this *BaseWriter) ResetFinish() {
 | 
						|
	this.isFinished = false
 | 
						|
}
 |