Record Class GzipWriter

java.lang.Object
java.lang.Record
cool.scx.http.media.gzip.GzipWriter
All Implemented Interfaces:
MediaWriter

public record GzipWriter(MediaWriter mediaWriter) extends Record implements MediaWriter
  • Constructor Details

    • GzipWriter

      public GzipWriter(MediaWriter mediaWriter)
      Creates an instance of a GzipWriter record class.
      Parameters:
      mediaWriter - the value for the mediaWriter record component
  • Method Details

    • beforeWrite

      public long beforeWrite(ScxHttpHeadersWritable responseHeaders, ScxHttpHeaders requestHeaders)
      Description copied from interface: MediaWriter
      写入内容之前 在这里可以设置 header 头
      Specified by:
      beforeWrite in interface MediaWriter
      Parameters:
      responseHeaders - 响应头 (在客户端状态下是 requestHeaders)
      requestHeaders - 请求头 (在客户端状态下是 空 Header)
      Returns:
      预期的内容长度 : (-1 未知长度, 0 无内容, 大于 0 标准长度)
    • write

      public void write(OutputStream outputStream) throws IOException
      Description copied from interface: MediaWriter
      写入内容
      Specified by:
      write in interface MediaWriter
      Parameters:
      outputStream - 输入流
      Throws:
      IOException
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • mediaWriter

      public MediaWriter mediaWriter()
      Returns the value of the mediaWriter record component.
      Returns:
      the value of the mediaWriter record component