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


Java Encdec.dec_uint16le方法代码示例

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


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

示例1: getNtlmsspListItem

import jcifs.util.Encdec; //导入方法依赖的package包/类
private String getNtlmsspListItem(byte[] type2token, int id0)
{
    int ri = 58;

    for ( ;; ) {
        int id = Encdec.dec_uint16le(type2token, ri);
        int len = Encdec.dec_uint16le(type2token, ri + 2);
        ri += 4;
        if (id == 0 || (ri + len) > type2token.length) {
            break;
        } else if (id == id0) {
            try {
                return new String(type2token, ri, len, SmbConstants.UNI_ENCODING);
            } catch (java.io.UnsupportedEncodingException uee) {
                break;
            }
        }
        ri += len;
    }

    return null;
}
 
开发者ID:codelibs,项目名称:jcifs,代码行数:23,代码来源:NtlmContext.java

示例2: doReceiveFragment

import jcifs.util.Encdec; //导入方法依赖的package包/类
protected void doReceiveFragment(byte[] buf, boolean isDirect) throws IOException {
    int off, flags, length;

    if (buf.length < max_recv)
        throw new IllegalArgumentException("buffer too small");

    if (isStart && !isDirect) { // start of new frag, do trans
        off = in.read(buf, 0, 1024);
    } else {
        off = in.readDirect(buf, 0, buf.length);
    }

    if (buf[0] != 5 && buf[1] != 0)
        throw new IOException("Unexpected DCERPC PDU header");

    flags = buf[3] & 0xFF;
    // next read is start of new frag
    isStart = (flags & DCERPC_LAST_FRAG) == DCERPC_LAST_FRAG;

    length = Encdec.dec_uint16le(buf, 8);
    if (length > max_recv)
        throw new IOException("Unexpected fragment length: " + length);

    while (off < length) {
        off += in.readDirect(buf, off, length - off);
    }
}
 
开发者ID:jaeksoft,项目名称:jcifs-krb5,代码行数:28,代码来源:DcerpcPipeHandle.java

示例3: dec_ndr_short

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

示例4: peekKey

import jcifs.util.Encdec; //导入方法依赖的package包/类
protected Request peekKey() throws IOException {
    int n;
    do {
        if ((n = readn( in, sbuf, 0, 4 )) < 4)
            return null;
    } while (sbuf[0] == (byte)0x85);  /* Dodge NetBIOS keep-alive */
                                               /* read smb header */
    if ((n = readn( in, sbuf, 4, 32 )) < 32)
        return null;
    if (log.level >= 4) {
        log.println( "New data read: " + this );
        jcifs.util.Hexdump.hexdump( log, sbuf, 4, 32 );
    }

    for ( ;; ) {
        /* 01234567
         * 00SSFSMB
         * 0 - 0's
         * S - size of payload
         * FSMB - 0xFF SMB magic #
         */

        if (sbuf[0] == (byte)0x00 &&
                    sbuf[1] == (byte)0x00 &&
                    sbuf[4] == (byte)0xFF &&
                    sbuf[5] == (byte)'S' &&
                    sbuf[6] == (byte)'M' &&
                    sbuf[7] == (byte)'B') {
            break; /* all good */
        }
                                    /* out of phase maybe? */
                      /* inch forward 1 byte and try again */
        for (int i = 0; i < 35; i++) {
            sbuf[i] = sbuf[i + 1];
        }
        int b;
        if ((b = in.read()) == -1) return null;
        sbuf[35] = (byte)b;
    }

    key.mid = Encdec.dec_uint16le( sbuf, 34 ) & 0xFFFF;

    /* Unless key returned is null or invalid Transport.loop() always
     * calls doRecv() after and no one else but the transport thread
     * should call doRecv(). Therefore it is ok to expect that the data
     * in sbuf will be preserved for copying into BUF in doRecv().
     */

    return key;
}
 
开发者ID:jaeksoft,项目名称:jcifs-krb5,代码行数:51,代码来源:SmbTransport.java

示例5: peekKey

import jcifs.util.Encdec; //导入方法依赖的package包/类
@Override
protected Long peekKey () throws IOException {
    do {
        if ( ( readn(this.in, this.sbuf, 0, 4) ) < 4 ) {
            return null;
        }
    }
    while ( this.sbuf[ 0 ] == (byte) 0x85 ); /* Dodge NetBIOS keep-alive */
    /* read smb header */
    if ( ( readn(this.in, this.sbuf, 4, SmbConstants.SMB1_HEADER_LENGTH) ) < SmbConstants.SMB1_HEADER_LENGTH ) {
        return null;
    }

    if ( log.isTraceEnabled() ) {
        log.trace("New data read: " + this);
        log.trace(Hexdump.toHexString(this.sbuf, 4, 32));
    }

    for ( ;; ) {
        /*
         * 01234567
         * 00SSFSMB
         * 0 - 0's
         * S - size of payload
         * FSMB - 0xFF SMB magic #
         */

        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' ) {
            this.smb2 = true;
            // also read the rest of the header
            int lenDiff = Smb2Constants.SMB2_HEADER_LENGTH - SmbConstants.SMB1_HEADER_LENGTH;
            if ( readn(this.in, this.sbuf, 4 + SmbConstants.SMB1_HEADER_LENGTH, lenDiff) < lenDiff ) {
                return null;
            }
            return (long) Encdec.dec_uint64le(this.sbuf, 28);
        }

        if ( this.sbuf[ 0 ] == (byte) 0x00 && this.sbuf[ 1 ] == (byte) 0x00 && ( this.sbuf[ 4 ] == (byte) 0xFF ) && this.sbuf[ 5 ] == (byte) 'S'
                && this.sbuf[ 6 ] == (byte) 'M' && this.sbuf[ 7 ] == (byte) 'B' ) {
            break; /* all good (SMB) */
        }

        /* out of phase maybe? */
        /* inch forward 1 byte and try again */
        for ( int i = 0; i < 35; i++ ) {
            log.warn("Possibly out of phase, trying to resync " + Hexdump.toHexString(this.sbuf, 0, 16));
            this.sbuf[ i ] = this.sbuf[ i + 1 ];
        }
        int b;
        if ( ( b = this.in.read() ) == -1 )
            return null;
        this.sbuf[ 35 ] = (byte) b;
    }

    /*
     * Unless key returned is null or invalid Transport.loop() always
     * calls doRecv() after and no one else but the transport thread
     * should call doRecv(). Therefore it is ok to expect that the data
     * in sbuf will be preserved for copying into BUF in doRecv().
     */

    return (long) Encdec.dec_uint16le(this.sbuf, 34) & 0xFFFF;
}
 
开发者ID:AgNO3,项目名称:jcifs-ng,代码行数:65,代码来源:SmbTransportImpl.java

示例6: dec_ndr_short

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


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