001package io.avaje.jsonb.spi; 002 003import io.avaje.jsonb.JsonReader; 004import io.avaje.jsonb.JsonWriter; 005 006import java.io.*; 007 008/** 009 * Provides the underlying JsonReader and JsonWriter to use. 010 */ 011public interface IOAdapter { 012 013 /** 014 * Return the JsonReader given json string content. 015 */ 016 JsonReader reader(String json); 017 018 /** 019 * Return the JsonReader given json content as bytes. 020 */ 021 JsonReader reader(byte[] json); 022 023 /** 024 * Return the JsonReader given json string content. 025 */ 026 JsonReader reader(Reader reader); 027 028 /** 029 * Return the JsonReader given json string content. 030 */ 031 JsonReader reader(InputStream inputStream); 032 033 /** 034 * Return the JsonWriter given writer to use. 035 */ 036 JsonWriter writer(Writer writer); 037 038 /** 039 * Return the JsonWriter given the outputStream. 040 */ 041 JsonWriter writer(OutputStream outputStream); 042 043 /** 044 * Return a JsonWriter for use for writing to json string. 045 */ 046 BufferedJsonWriter bufferedWriter(); 047 048 /** 049 * Return PropertyNames given the names of properties. 050 * <p> 051 * The PropertyNames can prepare the names for writing such as 052 * escaping quotes and encoding to bytes so that the names can 053 * be written more efficiently. 054 * 055 * @see JsonWriter#names(PropertyNames) 056 * @see JsonWriter#name(int) 057 */ 058 PropertyNames properties(String... names); 059}