♻️ Move output generation to state
[rhynodge.git] / src / main / java / net / pterodactylus / rhynodge / states / HttpState.java
index cdadd13..76dbc94 100644 (file)
@@ -21,6 +21,8 @@ import static java.util.Arrays.copyOf;
 
 import java.io.UnsupportedEncodingException;
 
+import javax.annotation.Nonnull;
+
 import net.pterodactylus.rhynodge.State;
 import net.pterodactylus.rhynodge.queries.HttpQuery;
 
@@ -106,6 +108,11 @@ public class HttpState extends AbstractState {
                return copyOf(rawResult, rawResult.length);
        }
 
+       @Override
+       public boolean isEmpty() {
+               return rawResult.length == 0;
+       }
+
        /**
         * Returns the decoded content of the reply. This method uses the charset
         * information from the {@link #contentType()}, if present, or UTF-8 if no
@@ -121,6 +128,12 @@ public class HttpState extends AbstractState {
                }
        }
 
+       @Nonnull
+       @Override
+       protected String plainText() {
+               return content();
+       }
+
        //
        // STATIC METHODS
        //