class JSONWriterUTF8Vector
        extends JSONWriterUTF8JDK9 {
    JSONWriterUTF8Vector(Context ctx) {
        super(ctx);
    }

    @Override
    public void writeString(String str) {
        if (str == null) {
            writeStringNull();
            return;
        }

        int coder = STRING_CODER.applyAsInt(str);
        byte[] value = STRING_VALUE.apply(str);

        if (coder == 0) {
            if ((context.features & BrowserSecure.mask) != 0) {
                writeStringLatin1BrowserSecure(value);
                return;
            }

            boolean escape = false;

            int i = 0;
            // vector optimize 8
            final int upperBound = (value.length - i) & ~7;
            for (; i < upperBound; i += 8) {
                Vector<Byte> v = ByteVector.SPECIES_64.fromArray(value, i);
                if (v.eq(V_BYTE_64_DOUBLE_QUOTE)
                        .or(v.eq(V_BYTE_64_SLASH))
                        .or(v.lt(V_BYTE_64_SPACE))
                        .anyTrue()
                ) {
                    escape = true;
                    break;
                }
            }

            if (!escape) {
                for (; i < value.length; ++i) {
                    byte c = value[i];
                    if (c == quote || c == '\\' || c < ' ') {
                        escape = true;
                        break;
                    }
                }
            }

            if (!escape) {
                int off = this.off;
                int minCapacity = off + value.length + 2;
                if (minCapacity >= this.bytes.length) {
                    ensureCapacity(minCapacity);
                }

                final byte[] bytes = this.bytes;
                bytes[off++] = (byte) this.quote;
                System.arraycopy(value, 0, bytes, off, value.length);
                off += value.length;
                bytes[off] = (byte) this.quote;
                this.off = off + 1;
                return;
            }
            writeStringEscaped(value);
            return;
            // end of latin
        }

        writeStringUTF16(value);
    }

    @Override
    public void writeStringLatin1(byte[] value) {<FILL_FUNCTION_BODY>}

    public static class Factory
            implements Function {
        @Override
        public Object apply(Object context) {
            return new JSONWriterUTF8Vector((Context) context);
        }
    }
}

        if ((context.features & BrowserSecure.mask) != 0) {
            writeStringLatin1BrowserSecure(value);
            return;
        }

        boolean escape = false;
        int i = 0;
        // vector optimize 8
        final int upperBound = (value.length - i) & ~7;
        for (; i < upperBound; i += 8) {
            Vector<Byte> v = ByteVector.SPECIES_64.fromArray(value, i);
            if (v.eq(V_BYTE_64_DOUBLE_QUOTE)
                    .or(v.eq(V_BYTE_64_SLASH))
                    .or(v.lt(V_BYTE_64_SPACE))
                    .anyTrue()) {
                escape = true;
                break;
            }
        }

        if (!escape) {
            for (; i < value.length; ++i) {
                byte c = value[i];
                if (c == quote || c == '\\' || c < ' ') {
                    escape = true;
                    break;
                }
            }
        }

        if (!escape) {
            int off = this.off;
            int minCapacity = off + value.length + 2;
            if (minCapacity >= this.bytes.length) {
                ensureCapacity(minCapacity);
            }

            final byte[] bytes = this.bytes;
            bytes[off++] = (byte) this.quote;
            System.arraycopy(value, 0, bytes, off, value.length);
            off += value.length;
            bytes[off] = (byte) this.quote;
            this.off = off + 1;
            return;
        }
        writeStringEscaped(value);
    
<methods>public void writeString(java.lang.String) <variables>