private static String readString ( byte[] buffer, int bufferIndex, int len ) { // this is not absolutely correct, but we assume that the header is aligned if ( ( bufferIndex % 2 ) != 0 ) { bufferIndex++; } return Strings.fromUNIBytes(buffer, bufferIndex, Strings.findUNITermination(buffer, bufferIndex, len)); }
private static String readString ( byte[] buffer, int bufferIndex, int len ) { // this is not absolutely correct, but we assume that the header is aligned if ( ( bufferIndex % 2 ) != 0 ) { bufferIndex++; } return Strings.fromUNIBytes(buffer, bufferIndex, Strings.findUNITermination(buffer, bufferIndex, len)); }
if ( ( this.negotiatedFlags2 & SmbConstants.FLAGS2_UNICODE ) == SmbConstants.FLAGS2_UNICODE ) { len = Strings.findUNITermination(buffer, bufferIndex, 256); this.server.oemDomainName = Strings.fromUNIBytes(buffer, bufferIndex, len);
if ( ( this.negotiatedFlags2 & SmbConstants.FLAGS2_UNICODE ) == SmbConstants.FLAGS2_UNICODE ) { len = Strings.findUNITermination(buffer, bufferIndex, 256); this.server.oemDomainName = Strings.fromUNIBytes(buffer, bufferIndex, len);
public String dec_ndr_string () throws NdrException { align(4); int i = this.index; String val = null; int len = Encdec.dec_uint32le(this.buf, i); i += 12; if ( len != 0 ) { len--; int size = len * 2; if ( size < 0 || size > 0xFFFF ) throw new NdrException(NdrException.INVALID_CONFORMANCE); val = Strings.fromUNIBytes(this.buf, i, size); i += size + 2; } advance(i - this.index); return val; }
public String dec_ndr_string () throws NdrException { align(4); int i = this.index; String val = null; int len = Encdec.dec_uint32le(this.buf, i); i += 12; if ( len != 0 ) { len--; int size = len * 2; if ( size < 0 || size > 0xFFFF ) throw new NdrException(NdrException.INVALID_CONFORMANCE); val = Strings.fromUNIBytes(this.buf, i, size); i += size + 2; } advance(i - this.index); return val; }
/** * * @param src * @param srcIndex * @param srcEnd * @param maxLen * @param unicode * @return read string */ public String readString ( byte[] src, int srcIndex, int srcEnd, int maxLen, boolean unicode ) { if ( unicode ) { // Unicode requires word alignment if ( ( ( srcIndex - this.headerStart ) % 2 ) != 0 ) { srcIndex++; } return Strings.fromUNIBytes(src, srcIndex, Strings.findUNITermination(src, srcIndex, maxLen)); } return Strings.fromOEMBytes(src, srcIndex, Strings.findTermination(src, srcIndex, maxLen), getConfig()); }
/** * * @param src * @param srcIndex * @param maxLen * @param unicode * @return read string */ public String readString ( byte[] src, int srcIndex, int maxLen, boolean unicode ) { if ( unicode ) { // Unicode requires word alignment if ( ( ( srcIndex - this.headerStart ) % 2 ) != 0 ) { srcIndex++; } return Strings.fromUNIBytes(src, srcIndex, Strings.findUNITermination(src, srcIndex, maxLen)); } return Strings.fromOEMBytes(src, srcIndex, Strings.findTermination(src, srcIndex, maxLen), getConfig()); }
/** * * @param src * @param srcIndex * @param maxLen * @param unicode * @return read string */ public String readString ( byte[] src, int srcIndex, int maxLen, boolean unicode ) { if ( unicode ) { // Unicode requires word alignment if ( ( ( srcIndex - this.headerStart ) % 2 ) != 0 ) { srcIndex++; } return Strings.fromUNIBytes(src, srcIndex, Strings.findUNITermination(src, srcIndex, maxLen)); } return Strings.fromOEMBytes(src, srcIndex, Strings.findTermination(src, srcIndex, maxLen), getConfig()); }
/** * * @param src * @param srcIndex * @param srcEnd * @param maxLen * @param unicode * @return read string */ public String readString ( byte[] src, int srcIndex, int srcEnd, int maxLen, boolean unicode ) { if ( unicode ) { // Unicode requires word alignment if ( ( ( srcIndex - this.headerStart ) % 2 ) != 0 ) { srcIndex++; } return Strings.fromUNIBytes(src, srcIndex, Strings.findUNITermination(src, srcIndex, maxLen)); } return Strings.fromOEMBytes(src, srcIndex, Strings.findTermination(src, srcIndex, maxLen), getConfig()); }
@Override public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException { if (len == 0) { // nothing to do return 0; } int start = bufferIndex; this.nextEntryOffset = SMBUtil.readInt4(buffer, bufferIndex); bufferIndex += 4; if ( ( this.nextEntryOffset % 4 ) != 0 ) { throw new SMBProtocolDecodingException("Non aligned nextEntryOffset"); } this.action = SMBUtil.readInt4(buffer, bufferIndex); bufferIndex += 4; this.fileNameLength = SMBUtil.readInt4(buffer, bufferIndex); bufferIndex += 4; this.fileName = Strings.fromUNIBytes(buffer, bufferIndex, this.fileNameLength); bufferIndex += this.fileNameLength; return bufferIndex - start; }
@Override public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException { if (len == 0) { // nothing to do return 0; } int start = bufferIndex; this.nextEntryOffset = SMBUtil.readInt4(buffer, bufferIndex); bufferIndex += 4; if ( ( this.nextEntryOffset % 4 ) != 0 ) { throw new SMBProtocolDecodingException("Non aligned nextEntryOffset"); } this.action = SMBUtil.readInt4(buffer, bufferIndex); bufferIndex += 4; this.fileNameLength = SMBUtil.readInt4(buffer, bufferIndex); bufferIndex += 4; this.fileName = Strings.fromUNIBytes(buffer, bufferIndex, this.fileNameLength); bufferIndex += this.fileNameLength; return bufferIndex - start; }
bufferIndex += 2; this.shortName = Strings.fromUNIBytes(buffer, bufferIndex, shortNameLength); bufferIndex += 24; fileNameLength -= 2; str = Strings.fromUNIBytes(buffer, bufferIndex, fileNameLength);
bufferIndex += 2; this.shortName = Strings.fromUNIBytes(buffer, bufferIndex, shortNameLength); bufferIndex += 24; fileNameLength -= 2; str = Strings.fromUNIBytes(buffer, bufferIndex, fileNameLength);