本文整理汇总了Java中jcifs.util.Encdec.enc_uint32be方法的典型用法代码示例。如果您正苦于以下问题:Java Encdec.enc_uint32be方法的具体用法?Java Encdec.enc_uint32be怎么用?Java Encdec.enc_uint32be使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jcifs.util.Encdec
的用法示例。
在下文中一共展示了Encdec.enc_uint32be方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doSend
import jcifs.util.Encdec; //导入方法依赖的package包/类
protected void doSend( Request request ) throws IOException {
synchronized (BUF) {
ServerMessageBlock smb = (ServerMessageBlock)request;
int n = smb.encode( BUF, 4 );
Encdec.enc_uint32be( n & 0xFFFF, BUF, 0 ); /* 4 byte session message header */
if (log.level >= 4) {
do {
log.println( smb );
} while (smb instanceof AndXServerMessageBlock &&
(smb = ((AndXServerMessageBlock)smb).andx) != null);
if (log.level >= 6) {
Hexdump.hexdump( log, BUF, 4, n );
}
}
/* For some reason this can sometimes get broken up into another
* "NBSS Continuation Message" frame according to WireShark
*/
out.write( BUF, 0, 4 + n );
}
}
示例2: negotiateWrite
import jcifs.util.Encdec; //导入方法依赖的package包/类
/**
* @return
* @throws IOException
*/
private int negotiateWrite ( CommonServerMessageBlockRequest req, boolean setmid ) throws IOException {
if ( setmid ) {
makeKey(req);
}
else {
req.setMid(0);
this.mid.set(1);
}
int n = req.encode(this.sbuf, 4);
Encdec.enc_uint32be(n & 0xFFFF, this.sbuf, 0); /* 4 byte ssn msg header */
if ( log.isTraceEnabled() ) {
log.trace(req.toString());
log.trace(Hexdump.toHexString(this.sbuf, 4, n));
}
this.out.write(this.sbuf, 0, 4 + n);
this.out.flush();
log.trace("Wrote negotiate request");
return n;
}
示例3: doSend
import jcifs.util.Encdec; //导入方法依赖的package包/类
@Override
protected void doSend ( Request request ) throws IOException {
CommonServerMessageBlock smb = (CommonServerMessageBlock) request;
byte[] buffer = this.getContext().getBufferCache().getBuffer();
try {
// synchronize around encode and write so that the ordering for SMB1 signing can be maintained
synchronized ( this.outLock ) {
int n = smb.encode(buffer, 4);
Encdec.enc_uint32be(n & 0xFFFF, buffer, 0); /* 4 byte session message header */
if ( log.isTraceEnabled() ) {
do {
log.trace(smb.toString());
}
while ( smb instanceof AndXServerMessageBlock && ( smb = ( (AndXServerMessageBlock) smb ).getAndx() ) != null );
log.trace(Hexdump.toHexString(buffer, 4, n));
}
/*
* For some reason this can sometimes get broken up into another
* "NBSS Continuation Message" frame according to WireShark
*/
this.out.write(buffer, 0, 4 + n);
this.out.flush();
}
}
finally {
this.getContext().getBufferCache().releaseBuffer(buffer);
}
}
示例4: writeInt
import jcifs.util.Encdec; //导入方法依赖的package包/类
public final void writeInt( int v ) throws SmbException {
Encdec.enc_uint32be( v, tmp, 0 );
write( tmp, 0, 4 );
}
示例5: negotiate
import jcifs.util.Encdec; //导入方法依赖的package包/类
private void negotiate( int port, ServerMessageBlock resp ) throws IOException {
/* We cannot use Transport.sendrecv() yet because
* the Transport thread is not setup until doConnect()
* returns and we want to supress all communication
* until we have properly negotiated.
*/
synchronized (sbuf) {
if (port == 139) {
ssn139();
} else {
if (port == 0)
port = DEFAULT_PORT; // 445
/* These Socket constructors attempt to connect before SO_TIMEOUT can be applied
if (localAddr == null) {
socket = new Socket( address.getHostAddress(), port );
} else {
socket = new Socket( address.getHostAddress(), port, localAddr, localPort );
}
socket.setSoTimeout( SO_TIMEOUT );
*/
socket = new Socket();
if (localAddr != null)
socket.bind(new InetSocketAddress(localAddr, localPort));
socket.connect(new InetSocketAddress(address.getHostAddress(), port), CONN_TIMEOUT);
socket.setSoTimeout( SO_TIMEOUT );
out = socket.getOutputStream();
in = socket.getInputStream();
}
if (++mid == 32000) mid = 1;
NEGOTIATE_REQUEST.mid = mid;
int n = NEGOTIATE_REQUEST.encode( sbuf, 4 );
Encdec.enc_uint32be( n & 0xFFFF, sbuf, 0 ); /* 4 byte ssn msg header */
if (log.level >= 4) {
log.println( NEGOTIATE_REQUEST );
if (log.level >= 6) {
Hexdump.hexdump( log, sbuf, 4, n );
}
}
out.write( sbuf, 0, 4 + n );
out.flush();
/* Note the Transport thread isn't running yet so we can
* read from the socket here.
*/
if (peekKey() == null) /* try to read header */
throw new IOException( "transport closed in negotiate" );
int size = Encdec.dec_uint16be( sbuf, 2 ) & 0xFFFF;
if (size < 33 || (4 + size) > sbuf.length ) {
throw new IOException( "Invalid payload size: " + size );
}
readn( in, sbuf, 4 + 32, size - 32 );
resp.decode( sbuf, 4 );
if (log.level >= 4) {
log.println( resp );
if (log.level >= 6) {
Hexdump.hexdump( log, sbuf, 4, n );
}
}
}
}
示例6: writeInt
import jcifs.util.Encdec; //导入方法依赖的package包/类
@Override
public final void writeInt ( int v ) throws SmbException {
Encdec.enc_uint32be(v, this.tmp, 0);
write(this.tmp, 0, 4);
}