java.lang.Object
org.codelibs.jcifs.smb.pac.PacDataInputStream
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
ConstructorsConstructorDescriptionConstructs a PAC data input stream from the given input stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidalign(int mask) Aligns the stream position to the specified boundary.intReturns the number of bytes available to read.bytereadByte()Reads a single byte value.charreadChar()Reads a 16-bit character value with proper alignment.Reads a Windows FILETIME value and converts it to a Date.voidreadFully(byte[] b) Reads bytes into the specified array.voidreadFully(byte[] b, int off, int len) Reads bytes into the specified array at the given offset.readId()Reads a 32-bit RID and constructs a SID from it.intreadInt()Reads a 32-bit integer value with proper alignment and byte order.longreadLong()Reads a 64-bit long value with proper alignment and byte order.shortReads a 16-bit short value with proper alignment and byte order.readSid()Reads a full Security Identifier (SID) structure.Reads a string with length prefix from the stream.Reads a PAC Unicode string structure.intReads an unsigned byte value.longReads an unsigned 32-bit integer value.intReads an unsigned 16-bit short value.intskipBytes(int n) Skips the specified number of bytes in the stream.
-
Constructor Details
-
PacDataInputStream
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
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
Returns the number of bytes available to read.- Returns:
- the number of available bytes
- Throws:
IOException- if an I/O error occurs
-
readFully
Reads bytes into the specified array.- Parameters:
b- the byte array to read into- Throws:
IOException- if an I/O error occurs
-
readFully
Reads bytes into the specified array at the given offset.- Parameters:
b- the byte array to read intooff- the start offset in the arraylen- the number of bytes to read- Throws:
IOException- if an I/O error occurs
-
readChar
Reads a 16-bit character value with proper alignment.- Returns:
- the character value
- Throws:
IOException- if an I/O error occurs
-
readByte
Reads a single byte value.- Returns:
- the byte value
- Throws:
IOException- if an I/O error occurs
-
readShort
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
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
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
Reads an unsigned byte value.- Returns:
- the unsigned byte value as an integer
- Throws:
IOException- if an I/O error occurs
-
readUnsignedInt
Reads an unsigned 32-bit integer value.- Returns:
- the unsigned integer value as a long
- Throws:
IOException- if an I/O error occurs
-
readUnsignedShort
Reads an unsigned 16-bit short value.- Returns:
- the unsigned short value as an integer
- Throws:
IOException- if an I/O error occurs
-
readFiletime
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
Reads a PAC Unicode string structure.- Returns:
- the PAC Unicode string object
- Throws:
IOException- if an I/O error occursPACDecodingException- if the string structure is malformed
-
readString
Reads a string with length prefix from the stream.- Returns:
- the decoded string
- Throws:
IOException- if an I/O error occursPACDecodingException- if the string structure is malformed
-
readId
Reads a 32-bit RID and constructs a SID from it.- Returns:
- the constructed SID object
- Throws:
IOException- if an I/O error occursPACDecodingException- if the SID data is invalid
-
readSid
Reads a full Security Identifier (SID) structure.- Returns:
- the SID object
- Throws:
IOException- if an I/O error occursPACDecodingException- if the SID data is invalid
-
skipBytes
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
-