ContentHandler.java

package fr.umlv.ji.tcp.server.http;
import fr.umlv.ji.tcp.server.Server;
import java.io.*;
/** Interface des gestionnaire de contenu. */
public interface ContentHandler {
  public Object getContent(long l, InputStream in) throws IOException;
  /** Gestionnaire de contenu par défaut. */
  static class Default implements ContentHandler {
    public Object getContent(long l, InputStream in) throws IOException {
      byte buffer[] = new byte[(int)l];
      DataInputStream stream = new DataInputStream(in);
      stream.readFully(buffer);
      return buffer;
    }
  }
}