Module jcifs

Class PacDataInputStream

java.lang.Object
org.codelibs.jcifs.smb.pac.PacDataInputStream

public class PacDataInputStream extends Object
Input stream for reading PAC data structures with proper alignment and byte ordering. Handles little-endian byte order and data alignment requirements of PAC structures.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a PAC data input stream from the given input stream.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    align(int mask)
    Aligns the stream position to the specified boundary.
    int
    Returns the number of bytes available to read.
    byte
    Reads a single byte value.
    char
    Reads a 16-bit character value with proper alignment.
    Reads a Windows FILETIME value and converts it to a Date.
    void
    readFully(byte[] b)
    Reads bytes into the specified array.
    void
    readFully(byte[] b, int off, int len)
    Reads bytes into the specified array at the given offset.
    Reads a 32-bit RID and constructs a SID from it.
    int
    Reads a 32-bit integer value with proper alignment and byte order.
    long
    Reads a 64-bit long value with proper alignment and byte order.
    short
    Reads a 16-bit short value with proper alignment and byte order.
    Reads a full Security Identifier (SID) structure.
    Reads a string with length prefix from the stream.
    Reads a PAC Unicode string structure.
    int
    Reads an unsigned byte value.
    long
    Reads an unsigned 32-bit integer value.
    int
    Reads an unsigned 16-bit short value.
    int
    skipBytes(int n)
    Skips the specified number of bytes in the stream.

    Methods inherited from class java.lang.Object

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

    • PacDataInputStream

      public PacDataInputStream(InputStream in) throws IOException
      Constructs a PAC data input stream from the given input stream.
      Parameters:
      in - the underlying input stream
      Throws:
      IOException - if an I/O error occurs
  • Method Details

    • align

      public void align(int mask) throws IOException
      Aligns the stream position to the specified boundary.
      Parameters:
      mask - the alignment mask (typically 2, 4, or 8)
      Throws:
      IOException - if an I/O error occurs
    • available

      public int available() throws IOException
      Returns the number of bytes available to read.
      Returns:
      the number of available bytes
      Throws:
      IOException - if an I/O error occurs
    • readFully

      public void readFully(byte[] b) throws IOException
      Reads bytes into the specified array.
      Parameters:
      b - the byte array to read into
      Throws:
      IOException - if an I/O error occurs
    • readFully

      public void readFully(byte[] b, int off, int len) throws IOException
      Reads bytes into the specified array at the given offset.
      Parameters:
      b - the byte array to read into
      off - the start offset in the array
      len - the number of bytes to read
      Throws:
      IOException - if an I/O error occurs
    • readChar

      public char readChar() throws IOException
      Reads a 16-bit character value with proper alignment.
      Returns:
      the character value
      Throws:
      IOException - if an I/O error occurs
    • readByte

      public byte readByte() throws IOException
      Reads a single byte value.
      Returns:
      the byte value
      Throws:
      IOException - if an I/O error occurs
    • readShort

      public short readShort() throws IOException
      Reads a 16-bit short value with proper alignment and byte order.
      Returns:
      the short value in little-endian format
      Throws:
      IOException - if an I/O error occurs
    • readInt

      public int readInt() throws IOException
      Reads a 32-bit integer value with proper alignment and byte order.
      Returns:
      the integer value in little-endian format
      Throws:
      IOException - if an I/O error occurs
    • readLong

      public long readLong() throws IOException
      Reads a 64-bit long value with proper alignment and byte order.
      Returns:
      the long value in little-endian format
      Throws:
      IOException - if an I/O error occurs
    • readUnsignedByte

      public int readUnsignedByte() throws IOException
      Reads an unsigned byte value.
      Returns:
      the unsigned byte value as an integer
      Throws:
      IOException - if an I/O error occurs
    • readUnsignedInt

      public long readUnsignedInt() throws IOException
      Reads an unsigned 32-bit integer value.
      Returns:
      the unsigned integer value as a long
      Throws:
      IOException - if an I/O error occurs
    • readUnsignedShort

      public int readUnsignedShort() throws IOException
      Reads an unsigned 16-bit short value.
      Returns:
      the unsigned short value as an integer
      Throws:
      IOException - if an I/O error occurs
    • readFiletime

      public Date readFiletime() throws IOException
      Reads a Windows FILETIME value and converts it to a Date.
      Returns:
      the Date object, or null if the time represents infinity
      Throws:
      IOException - if an I/O error occurs
    • readUnicodeString

      public PacUnicodeString readUnicodeString() throws IOException, PACDecodingException
      Reads a PAC Unicode string structure.
      Returns:
      the PAC Unicode string object
      Throws:
      IOException - if an I/O error occurs
      PACDecodingException - if the string structure is malformed
    • readString

      public String readString() throws IOException, PACDecodingException
      Reads a string with length prefix from the stream.
      Returns:
      the decoded string
      Throws:
      IOException - if an I/O error occurs
      PACDecodingException - if the string structure is malformed
    • readId

      public SID readId() throws IOException, PACDecodingException
      Reads a 32-bit RID and constructs a SID from it.
      Returns:
      the constructed SID object
      Throws:
      IOException - if an I/O error occurs
      PACDecodingException - if the SID data is invalid
    • readSid

      public SID readSid() throws IOException, PACDecodingException
      Reads a full Security Identifier (SID) structure.
      Returns:
      the SID object
      Throws:
      IOException - if an I/O error occurs
      PACDecodingException - if the SID data is invalid
    • skipBytes

      public int skipBytes(int n) throws IOException
      Skips the specified number of bytes in the stream.
      Parameters:
      n - the number of bytes to skip
      Returns:
      the actual number of bytes skipped
      Throws:
      IOException - if an I/O error occurs