private byte[] getPascalCharBytes() {
		try {
			int len;
			int offset;
			switch (stringLayout) {
				case PASCAL_255:
					len = buf.getUnsignedByte(0) * paddedCharSize;
					offset = SIZEOF_PASCAL255_STR_LEN_FIELD;
					break;
				case PASCAL_64k:
					len = buf.getUnsignedShort(0) * paddedCharSize;
					offset = SIZEOF_PASCAL64k_STR_LEN_FIELD;
					break;
				default:
					throw new IllegalArgumentException();
			}
			WrappedMemBuffer pascalBuf = new WrappedMemBuffer(buf, offset);
			return getBytesFromMemBuff(pascalBuf, len);
		}
		catch (MemoryAccessException e) {
			Msg.error(this, "PascalString error: " + e.getMessage());
		}
		return null;
	}
Returns the string contained in the specified {@link MemBuffer}, or null if all the bytes of
the string could not be read.
<p>
This method deals in characters of size {@link #charSize}, that might be
{@link #paddedCharSize padded} to a larger size. The raw n-byte characters are converted into
a Java String using a Java {@link Charset} or by using a custom Ghidra conversion. (see
convertBytesToStringCustomCharset)
<p>
The MemBuffer's endian'ness is used to determine which end of the {@link #paddedCharSize
padded } field contains our {@link #charSize} character bytes which will be used to create
the java String.

@return String containing the characters in buf or null if unable to read all {@code length}
        bytes from the membuffer.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/StringDataInstance.java