Module jcifs

Class Smb2Lock

java.lang.Object
org.codelibs.jcifs.smb.internal.smb2.lock.Smb2Lock
All Implemented Interfaces:
Encodable

public class Smb2Lock extends Object implements Encodable
SMB2 Lock data structure. This class represents a single lock element used in SMB2 Lock requests for byte-range locking.
Author:
mbechler
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Flag indicating an exclusive lock that prevents any other access.
    static final int
    Flag indicating the lock should fail immediately if it cannot be granted.
    static final int
    Flag indicating a shared lock that allows concurrent read access.
    static final int
    Flag indicating an unlock operation to release a previously held lock.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Smb2Lock(long offset, long length, int flags)
    Constructs an SMB2 lock element with the specified parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    encode(byte[] dst, int dstIndex)
    Encodes this object into the specified byte array.
    int
    Returns the size in bytes that this object will occupy when encoded.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SMB2_LOCKFLAG_SHARED_LOCK

      public static final int SMB2_LOCKFLAG_SHARED_LOCK
      Flag indicating a shared lock that allows concurrent read access.
      See Also:
    • SMB2_LOCKFLAG_EXCLUSIVE_LOCK

      public static final int SMB2_LOCKFLAG_EXCLUSIVE_LOCK
      Flag indicating an exclusive lock that prevents any other access.
      See Also:
    • SMB2_LOCKFLAG_UNLOCK

      public static final int SMB2_LOCKFLAG_UNLOCK
      Flag indicating an unlock operation to release a previously held lock.
      See Also:
    • SMB2_LOCKFLAG_FAIL_IMMEDIATELY

      public static final int SMB2_LOCKFLAG_FAIL_IMMEDIATELY
      Flag indicating the lock should fail immediately if it cannot be granted.
      See Also:
  • Constructor Details

    • Smb2Lock

      public Smb2Lock(long offset, long length, int flags)
      Constructs an SMB2 lock element with the specified parameters.
      Parameters:
      offset - the byte offset in the file where the lock begins
      length - the number of bytes to lock
      flags - the lock flags (combination of SMB2_LOCKFLAG_* constants)
  • Method Details

    • size

      public int size()
      Returns the size in bytes that this object will occupy when encoded.
      Specified by:
      size in interface Encodable
      Returns:
      the encoded size
      See Also:
    • encode

      public int encode(byte[] dst, int dstIndex)
      Encodes this object into the specified byte array.
      Specified by:
      encode in interface Encodable
      Parameters:
      dst - the destination byte array to encode into
      dstIndex - the starting index in the destination array
      Returns:
      encoded length
      See Also: