Package com.meeshkan.http.types
Class HttpExchangeWriter
- java.lang.Object
-
- com.meeshkan.http.types.HttpExchangeWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class HttpExchangeWriter extends java.lang.Object implements java.io.Closeable
Writer ofHTTP exchanges
in the HTTP Types JSON Lines format.Output written using this writer can be read back using a
HttpExchangeReader
.
-
-
Constructor Summary
Constructors Constructor Description HttpExchangeWriter(@NotNull java.io.OutputStream out)
Creates a HTTP exchange writer that uses the specified output stream.HttpExchangeWriter(@NotNull java.io.Writer out)
Creates a HTTP exchange writer that uses the specified output writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
write(@NotNull HttpExchange exchange)
Writes a HTTP exchange as a single JSON formatted line.void
writeAll(@NotNull java.util.Collection<HttpExchange> exchanges)
Writes multiple HTTP Exchanges, each formatted in JSON format on a single line.
-
-
-
Constructor Detail
-
HttpExchangeWriter
public HttpExchangeWriter(@NotNull @NotNull java.io.OutputStream out)
Creates a HTTP exchange writer that uses the specified output stream.- Parameters:
out
- Output where to write the serialized HTTP exchanges
-
HttpExchangeWriter
public HttpExchangeWriter(@NotNull @NotNull java.io.Writer out)
Creates a HTTP exchange writer that uses the specified output writer.- Parameters:
out
- Output where to write the serialized HTTP exchanges
-
-
Method Detail
-
write
public void write(@NotNull @NotNull HttpExchange exchange)
Writes a HTTP exchange as a single JSON formatted line.- Parameters:
exchange
- The HTTP exchange to write- See Also:
writeAll(Collection)
-
writeAll
public void writeAll(@NotNull @NotNull java.util.Collection<HttpExchange> exchanges)
Writes multiple HTTP Exchanges, each formatted in JSON format on a single line.- Parameters:
exchanges
- The HTTP exchanges to write- See Also:
write(HttpExchange)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-