当前位置: 首页>>代码示例>>Java>>正文


Java Encdec.dec_uint32le方法代码示例

本文整理汇总了Java中jcifs.util.Encdec.dec_uint32le方法的典型用法代码示例。如果您正苦于以下问题:Java Encdec.dec_uint32le方法的具体用法?Java Encdec.dec_uint32le怎么用?Java Encdec.dec_uint32le使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jcifs.util.Encdec的用法示例。


在下文中一共展示了Encdec.dec_uint32le方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dec_ndr_string

import jcifs.util.Encdec; //导入方法依赖的package包/类
public String dec_ndr_string() throws NdrException {
    align(4);
    int i = index;
    String val = null;
    int len = Encdec.dec_uint32le(buf, i);
    i += 12;
    if (len != 0) {
        len--;
        int size = len * 2;
        try {
            if (size < 0 || size > 0xFFFF) throw new NdrException( NdrException.INVALID_CONFORMANCE );
            val = new String(buf, i, size, "UTF-16LE");
            i += size + 2;
        } catch( UnsupportedEncodingException uee ) {
        }
    }
    advance(i - index);
    return val;
}
 
开发者ID:codelibs,项目名称:jcifs,代码行数:20,代码来源:NdrBuffer.java

示例2: dec_ndr_string

import jcifs.util.Encdec; //导入方法依赖的package包/类
public String dec_ndr_string () throws NdrException {
    align(4);
    int i = this.index;
    String val = null;
    int len = Encdec.dec_uint32le(this.buf, i);
    i += 12;
    if ( len != 0 ) {
        len--;
        int size = len * 2;
        if ( size < 0 || size > 0xFFFF )
            throw new NdrException(NdrException.INVALID_CONFORMANCE);
        val = Strings.fromUNIBytes(this.buf, i, size);
        i += size + 2;
    }
    advance(i - this.index);
    return val;
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:18,代码来源:NdrBuffer.java

示例3: doRecvSMB1

import jcifs.util.Encdec; //导入方法依赖的package包/类
/**
 * @param resp
 * @throws IOException
 * @throws SMBProtocolDecodingException
 */
private void doRecvSMB1 ( CommonServerMessageBlock resp ) throws IOException, SMBProtocolDecodingException {
    byte[] buffer = getContext().getBufferCache().getBuffer();
    try {
        System.arraycopy(this.sbuf, 0, buffer, 0, 4 + SMB1_HEADER_LENGTH);
        int size = ( Encdec.dec_uint16be(buffer, 2) & 0xFFFF );
        if ( size < ( SMB1_HEADER_LENGTH + 1 ) || ( 4 + size ) > Math.min(0xFFFF, getContext().getConfig().getMaximumBufferSize()) ) {
            throw new IOException("Invalid payload size: " + size);
        }
        int errorCode = Encdec.dec_uint32le(buffer, 9) & 0xFFFFFFFF;
        if ( resp.getCommand() == ServerMessageBlock.SMB_COM_READ_ANDX && ( errorCode == 0 || errorCode == 0x80000005 ) ) {
            // overflow indicator normal for pipe
            SmbComReadAndXResponse r = (SmbComReadAndXResponse) resp;
            int off = SMB1_HEADER_LENGTH;
            /* WordCount thru dataOffset always 27 */
            readn(this.in, buffer, 4 + off, 27);
            off += 27;
            resp.decode(buffer, 4);
            /* EMC can send pad w/o data */
            int pad = r.getDataOffset() - off;
            if ( r.getByteCount() > 0 && pad > 0 && pad < 4 )
                readn(this.in, buffer, 4 + off, pad);

            if ( r.getDataLength() > 0 ) {
                readn(this.in, r.getData(), r.getOffset(), r.getDataLength()); /* read direct */
            }
        }
        else {
            readn(this.in, buffer, 4 + SMB1_HEADER_LENGTH, size - SMB1_HEADER_LENGTH);
            resp.decode(buffer, 4);
        }
    }
    finally {
        getContext().getBufferCache().releaseBuffer(buffer);
    }
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:41,代码来源:SmbTransportImpl.java

示例4: dec_ndr_long

import jcifs.util.Encdec; //导入方法依赖的package包/类
public int dec_ndr_long() {
    align(4);
    int val = Encdec.dec_uint32le(buf, index);
    advance(4);
    return val;
}
 
开发者ID:codelibs,项目名称:jcifs,代码行数:7,代码来源:NdrBuffer.java

示例5: doRecv

import jcifs.util.Encdec; //导入方法依赖的package包/类
protected void doRecv( Response response ) throws IOException {
    ServerMessageBlock resp = (ServerMessageBlock)response;
    resp.useUnicode = useUnicode;
    resp.extendedSecurity = (capabilities & CAP_EXTENDED_SECURITY) == CAP_EXTENDED_SECURITY;

    synchronized (BUF) {
        System.arraycopy( sbuf, 0, BUF, 0, 4 + HEADER_LENGTH );
        int size = Encdec.dec_uint16be( BUF, 2 ) & 0xFFFF;
        if (size < (HEADER_LENGTH + 1) || (4 + size) > rcv_buf_size ) {
            throw new IOException( "Invalid payload size: " + size );
        }
        int errorCode = Encdec.dec_uint32le( BUF, 9 ) & 0xFFFFFFFF;
        if (resp.command == ServerMessageBlock.SMB_COM_READ_ANDX &&
                    (errorCode == 0 ||
                    errorCode == 0x80000005)) { // overflow indicator normal for pipe
            SmbComReadAndXResponse r = (SmbComReadAndXResponse)resp;
            int off = HEADER_LENGTH;
                                /* WordCount thru dataOffset always 27 */
            readn( in, BUF, 4 + off, 27 ); off += 27;
            resp.decode( BUF, 4 );
                                          /* EMC can send pad w/o data */
            int pad = r.dataOffset - off;
            if (r.byteCount > 0 && pad > 0 && pad < 4)
                readn( in, BUF, 4 + off, pad);

            if (r.dataLength > 0)
                readn( in, r.b, r.off, r.dataLength );  /* read direct */
        } else {
            readn( in, BUF, 4 + 32, size - 32 );
            resp.decode( BUF, 4 );
            if (resp instanceof SmbComTransactionResponse) {
                ((SmbComTransactionResponse)resp).nextElement();
            }
        }

        /* Verification fails (w/ W2K3 server at least) if status is not 0. This
         * suggests MS doesn't compute the signature (correctly) for error responses
         * (perhaps for DOS reasons).
         */
        if (digest != null && resp.errorCode == 0) {
            digest.verify( BUF, 4, resp );
        }

        if (log.level >= 4) {
            log.println( response );
            if (log.level >= 6) {
                Hexdump.hexdump( log, BUF, 4, size );
            }
        }
    }
}
 
开发者ID:jaeksoft,项目名称:jcifs-krb5,代码行数:52,代码来源:SmbTransport.java

示例6: doRecvSMB2

import jcifs.util.Encdec; //导入方法依赖的package包/类
/**
 * @param response
 * @throws IOException
 * @throws SMBProtocolDecodingException
 */
private void doRecvSMB2 ( CommonServerMessageBlock response ) throws IOException, SMBProtocolDecodingException {
    int size = ( Encdec.dec_uint16be(this.sbuf, 2) & 0xFFFF ) | ( this.sbuf[ 1 ] & 0xFF ) << 16;
    if ( size < ( Smb2Constants.SMB2_HEADER_LENGTH + 1 ) ) {
        throw new IOException("Invalid payload size: " + size);
    }

    if ( this.sbuf[ 0 ] != (byte) 0x00 || this.sbuf[ 4 ] != (byte) 0xFE || this.sbuf[ 5 ] != (byte) 'S' || this.sbuf[ 6 ] != (byte) 'M'
            || this.sbuf[ 7 ] != (byte) 'B' ) {
        throw new IOException("Houston we have a synchronization problem");
    }

    int nextCommand = Encdec.dec_uint32le(this.sbuf, 4 + 20);
    int maximumBufferSize = getContext().getConfig().getMaximumBufferSize();
    int msgSize = nextCommand != 0 ? nextCommand : size;
    if ( msgSize > maximumBufferSize ) {
        throw new IOException(String.format("Message size %d exceeds maxiumum buffer size %d", msgSize, maximumBufferSize));
    }

    ServerMessageBlock2Response cur = (ServerMessageBlock2Response) response;
    byte[] buffer = getContext().getBufferCache().getBuffer();
    try {
        int rl = nextCommand != 0 ? nextCommand : size;

        // read and decode first
        System.arraycopy(this.sbuf, 4, buffer, 0, Smb2Constants.SMB2_HEADER_LENGTH);
        readn(this.in, buffer, Smb2Constants.SMB2_HEADER_LENGTH, rl - Smb2Constants.SMB2_HEADER_LENGTH);

        int len = cur.decode(buffer, 0);

        if ( len > rl ) {
            throw new IOException(String.format("WHAT? ( read %d decoded %d ): %s", rl, len, cur));
        }
        else if ( nextCommand != 0 && len > nextCommand ) {
            throw new IOException("Overlapping commands");
        }
        size -= rl;

        while ( size > 0 && nextCommand != 0 ) {
            cur = (ServerMessageBlock2Response) cur.getNextResponse();
            if ( cur == null ) {
                log.warn("Response not properly set up");
                this.in.skip(size);
                break;
            }

            // read next header
            readn(this.in, buffer, 0, Smb2Constants.SMB2_HEADER_LENGTH);
            nextCommand = Encdec.dec_uint32le(buffer, 20);

            if ( ( nextCommand != 0 && nextCommand > maximumBufferSize ) || ( nextCommand == 0 && size > maximumBufferSize ) ) {
                throw new IOException(
                    String.format("Message size %d exceeds maxiumum buffer size %d", nextCommand != 0 ? nextCommand : size, maximumBufferSize));
            }

            rl = nextCommand != 0 ? nextCommand : size;

            if ( log.isDebugEnabled() ) {
                log.debug(String.format("Compound next command %d read size %d remain %d", nextCommand, rl, size));
            }

            readn(this.in, buffer, Smb2Constants.SMB2_HEADER_LENGTH, rl - Smb2Constants.SMB2_HEADER_LENGTH);

            len = cur.decode(buffer, 0, true);
            if ( len > rl ) {
                throw new IOException(String.format("WHAT? ( read %d decoded %d ): %s", rl, len, cur));
            }
            else if ( nextCommand != 0 && len > nextCommand ) {
                throw new IOException("Overlapping commands");
            }
            size -= rl;
        }
    }
    finally {
        getContext().getBufferCache().releaseBuffer(buffer);
    }
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:82,代码来源:SmbTransportImpl.java

示例7: dec_ndr_long

import jcifs.util.Encdec; //导入方法依赖的package包/类
public int dec_ndr_long () {
    align(4);
    int val = Encdec.dec_uint32le(this.buf, this.index);
    advance(4);
    return val;
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:7,代码来源:NdrBuffer.java


注:本文中的jcifs.util.Encdec.dec_uint32le方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。