@Override
	public void close() throws IOException
	{
		synchronized(this)
		{
			CoderResult result;
			if( null == decoder )
			{
				return;
			}

			// flush the input buffer
			inputBuffer.flip();
			do
			{
				outputBuffer.clear();
				result = decoder.decode( inputBuffer, outputBuffer, true );

				outputBuffer.flip();
				target.append( outputBuffer );
			} while( result.equals( CoderResult.OVERFLOW ) );

			// flush the decoder
			do
			{
				outputBuffer.clear();
				result = decoder.flush( outputBuffer );

				outputBuffer.flip();
				target.append( outputBuffer );
			} while( result.equals( CoderResult.OVERFLOW ) );

			// release the buffers and decoder
			inputBuffer = null;
			outputBuffer = null;
			decoder = null;
		}

		// close the underlying Writer, if any
		if( target instanceof Writer )
		{
			((Writer) target).close();
		}
	}