{@inheritDoc}

@see jcifs.Decodable#decode(byte[], int, int)
506742
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        this.createTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;
        this.lastAccessTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;
        this.lastWriteTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;
        this.changeTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;
        this.attributes = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        return bufferIndex - start;
    }
572666
public int decode(ByteBuffer b, char[] chars, int pos, int len) {
		if (io != null)
			throw new IllegalStateException();
		return decode(b, chars, pos, len, null, 1);
	}
1298329
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        this.chunksWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.chunkBytesWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        this.totalBytesWritten = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        return bufferIndex - start;
    }
601078
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;

        this.capabilities = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;

        System.arraycopy(buffer, bufferIndex, this.serverGuid, 0, 16);
        bufferIndex += 16;

        this.securityMode = SMBUtil.readInt2(buffer, bufferIndex);
        this.dialect = SMBUtil.readInt2(buffer, bufferIndex + 2);
        bufferIndex += 4;

        return bufferIndex - start;
    }
880762
static final int decodeFromBytes(final byte[] arcs, final int start, final int n) {
    int r = 0;
    for (int i = n; --i >= 0;) {
      r = r << 8 | (arcs[start + i] & 0xff);
    }
    return r;
  }
147941
public final byte[] decode(byte[] source, int off, int len) {
		int	len34 = len * 3 / 4;
		byte[] outBuff = new byte[len34]; // upper limit on size of output
		int	outBuffPosn = 0;
		
		byte[] b4 = new byte[4];
		int	b4Posn = 0;
		int	i = 0;
		byte sbiCrop = 0;
		byte sbiDecode = 0;
		for (i = off; i < off + len; i++) {
			sbiCrop = (byte)(source[i] & 0x7f); // only the low seven bits
			sbiDecode = DECODABET[sbiCrop];
			
			if (sbiDecode >= WHITE_SPACE_ENC) { // white space, equals sign or better
				if (sbiDecode >= PADDING_CHAR_ENC) {
					b4[b4Posn++] = sbiCrop;
					if (b4Posn > 3) {
						outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn);
						b4Posn = 0;
						
						// if that was the padding char, break out of 'for' loop
						if (sbiCrop == PADDING_CHAR) {
							break;
						}
					} // end if: quartet built
				} // end if: equals sign or better
			} // end if: white space, equals sign or better
			else {
				//discard
			} 
		} // each input character
								   
		byte[] out = new byte[outBuffPosn];
		System.arraycopy(outBuff, 0, out, 0, outBuffPosn); 
		return out;
	}
184536
@Override
    public void decode(byte[] bytes, StringBuilder buffer) {
        if (bytes == null) {
            // append nothing
            return;
        }

        char[] table = CHAR_TABLE;
        for (int i = 0; i < bytes.length; i++) {
            int code = (int)bytes[i] & 0x000000ff;
            if (code == EXTENDED_ESCAPE) {
                // take next char from extension table
                table = EXT_CHAR_TABLE;
            } else {
                buffer.append((code >= table.length) ? '?' : table[code]);
                // go back to the default table
                table = CHAR_TABLE;
            }
        }
    }
1309979
@Override
    public int decode ( byte[] buffer, int bufferIndex ) throws SMBProtocolDecodingException {
        int len = super.decode(buffer, bufferIndex);
        if ( this.byteCount == 0 ) {
            // otherwise hasMore may not be correctly set
            readBytesWireFormat(buffer, len + bufferIndex);
        }
        nextElement();
        return len;
    }
415219
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        int nalgos = SMBUtil.readInt2(buffer, bufferIndex);
        int nsalt = SMBUtil.readInt2(buffer, bufferIndex + 2);
        bufferIndex += 4;

        this.hashAlgos = new int[nalgos];
        for ( int i = 0; i < nalgos; i++ ) {
            this.hashAlgos[ i ] = SMBUtil.readInt2(buffer, bufferIndex);
            bufferIndex += 2;
        }

        this.salt = new byte[nsalt];
        System.arraycopy(buffer, bufferIndex, this.salt, 0, nsalt);
        bufferIndex += nsalt;

        return bufferIndex - start;
    }
389154
@Nonnull
  @ReturnsMutableCopy
  public static byte [] decode (@Nonnull final String s) throws IOException
  {
    return decode (s, NO_OPTIONS);
  }
656705
public void decode(InputStream is, OutputStream os) throws IOException {
	   int read, idx=0;
	   int prev=0, index;
	   	while((read = is.read())>=0) {
	   		index = convert.convert(read);
	   		if(index>=0) {
	    		switch(++idx) { // 1 based cases, slightly faster ++
	    			case 1: // index goes into first 6 bits of prev
	    				prev = index<<2; 
	    				break;
	    			case 2: // write second 2 bits of into prev, write byte, last 4 bits go into prev
	    				os.write((byte)(prev|(index>>4)));
	    				prev = index<<4;
	    				break;
	    			case 3: // first 4 bits of index goes into prev, write byte, last 2 bits go into prev
	    				os.write((byte)(prev|(index>>2)));
	    				prev = index<<6;
	    				break;
	    			default: // (3+) | prev and last six of index
	    				os.write((byte)(prev|(index&0x3F)));
	    				idx = prev = 0;
	    		}
	   		}
	   	};
	   	os.flush();
   }
342325
public static byte[] decode( byte[] source, int off, int len )
    {
        int    len34   = len * 3 / 4;
        byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
        int    outBuffPosn = 0;
        
        byte[] b4        = new byte[4];
        int    b4Posn    = 0;
        int    i         = 0;
        byte   sbiCrop   = 0;
        byte   sbiDecode = 0;
        for( i = 0; i < len; i++ )
        {
            sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
            sbiDecode = DECODABET[ sbiCrop ];
            
            if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better
            {
                if( sbiDecode >= EQUALS_SIGN_ENC )
                {
                    b4[ b4Posn++ ] = sbiCrop;
                    if( b4Posn > 3 )
                    {
                        outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn );
                        b4Posn = 0;
                        
                        // If that was the equals sign, break out of 'for' loop
                        if( sbiCrop == EQUALS_SIGN )
                            break;
                    }   // end if: quartet built
                    
                }   // end if: equals sign or better
                
            }   // end if: white space, equals sign or better
            else
            {
				LoggerFactory.getDefaultLogger().error( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
                return null;
            }   // end else: 
        }   // each input character
                                   
        byte[] out = new byte[ outBuffPosn ];
        System.arraycopy( outBuff, 0, out, 0, outBuffPosn ); 
        return out;
    }
1101819
private static int decodeOctets(int i, ByteBuffer bb, StringBuilder sb) {
        // If there is only one octet and is an ASCII character
        if (bb.limit() == 1 && (bb.get(0) & 0xFF) < 0x80) {
            // Octet can be appended directly
            sb.append((char) bb.get(0));
            return i + 2;
        } else {
            //
            CharBuffer cb = UTF_8_CHARSET.decode(bb);
            sb.append(cb.toString());
            return i + bb.limit() * 3 - 1;
        }
    }
5851
public static byte[] decodeToBytes(CharSequence in) throws IOException{
		if(in == null) return null;
		ByteArrayOutputStream baos = new ByteArrayOutputStream(in.length());
		decode(in, baos);
		return baos.toByteArray();
	}
756390
private byte[] decode(byte[] input) throws DecoderException
    {
        if (decoder != null)
        {
            return decoder.decode(input);
        }
        else
        {
            return DEFAULT_CODER.decode(input);
        }
    }
1331245
@SneakyThrows
    public static String decodeByteArrayToString(final byte[] bytes) {
        @Cleanup
        val bais = new ByteArrayInputStream(bytes);
        @Cleanup
        val baos = new ByteArrayOutputStream();
        val buf = new byte[bytes.length];
        try (val iis = new InflaterInputStream(bais)) {
            var count = iis.read(buf);
            while (count != -1) {
                baos.write(buf, 0, count);
                count = iis.read(buf);
            }
            return new String(baos.toByteArray(), StandardCharsets.UTF_8);
        } catch (final Exception e) {
            LOGGER.error("Base64 decoding failed", e);
            return null;
        }
    }
812314
@Pure
	@Inline(value = "Base64Coder.decode(($1).toCharArray())", imported = {Base64Coder.class})
	public static byte[] decode(String string) {
		return decode(string.toCharArray());
	}