All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.archive.format.http.HttpHeader Maven / Gradle / Ivy

There is a newer version: 1.1.9
Show newest version
package org.archive.format.http;

import java.io.IOException;
import java.io.OutputStream;

public class HttpHeader implements HttpConstants {
	private String name = null;
	private String value = null;

	public HttpHeader() {}

	public HttpHeader(String name, String value) {
		this.name = name;
		this.value = value;
	}

	public String getName()              { return name;        }
	public void   setName(String name)   { this.name = name;   }
	public String getValue()             { return value;       }
	public void   setValue(String value) { this.value = value; }

	public void write(OutputStream out) throws IOException {
		out.write(name.getBytes(UTF8));  out.write(COLON); out.write(SP);

		out.write(value.getBytes(UTF8)); out.write(CR);    out.write(LF);
	}

	public String toString() {
		StringBuilder sb = new StringBuilder(name.length() + value.length()+20);
		sb.append(String.format("HttpHeader(%s)(%s)",name,value));
		return sb.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy