package com.swandiggy.poe4j.data.readers.value;

import com.swandiggy.poe4j.data.DatFileReader;
import org.springframework.stereotype.Service;

/**
 * Read a string value. Reads an int pointer into the variable width portion of the file. Strings are null terminated
 * and encoded as UTF-16LE.
 *
 * @author Jacob Swanson
 * @since 12/15/2015
 */
public class StringReader extends BaseValueReader<String> {

    public StringReader() {
    }

    @Override
    public boolean supports(Class clazz) {
        return clazz == String.class;
    }

    @Override
    protected String readInternal(DatFileReader reader, Class clazz) {
        int ref = reader.getBr().readInt();

        long oldPos = reader.getBr().getPosition();
        reader.getBr().setPosition(reader.getDataOffset() + ref);
        String s = reader.getBr().readString("UTF-16LE");
        reader.getBr().setPosition(oldPos);

        return s;
    }

    @Override
    public int size(Class clazz) {
        return 4;
    }
}

@@ -100,46 +100,33 @@
 ort 
-org.springframework.stereotype.Service
+lombok.extern.slf4j.Slf4j
 ;%0A%0A/
@@ -327,16 +327,23 @@
 015%0A */%0A
+@Slf4j%0A
 public c
@@ -658,24 +658,24 @@
 readInt();%0A%0A
-
         long
@@ -714,16 +714,277 @@
 tion();%0A
+        long stringPos = reader.getDataOffset() + ref;%0A        if (stringPos %3E= reader.getFile().length()) %7B%0A            log.warn(%22String was at end of file eof: '%7B%7D', string ref: '%7B%7D'%22, reader.getFile().length(), stringPos);%0A            return null;%0A        %7D%0A
         

Add check if string is at EOF