for (int len = 0; ((len = input.readLine(buf, 0, buf.length)) != -1);) {
switch (status) {
case BOUNDARY:
if(buf[len - 1] != '\n')
throw new HttpServerException("boundary format error");
String currentBoundary = new String(buf, 0, len, charset).trim();
buf = new byte[headBufSize];
if(!currentBoundary.equals("--" + boundary))
throw new HttpServerException("boundary [" + currentBoundary + "] format error");
part = new PartImpl();
status = Status.HEAD;
break;
case HEAD:
if(buf[len - 1] != '\n')
throw new HttpServerException("head format error");
String headInfo = new String(buf, 0, len, charset).trim();
if(VerifyUtils.isEmpty(headInfo)) {
buf = new byte[dataBufSize];
status = Status.DATA;
break;
}
buf = new byte[headBufSize];
String[] t = StringUtils.split(headInfo, ":", 2);
if(t.length != 2)
throw new HttpServerException("head [" + headInfo + "] format error");
part.headMap.put(t[0].toLowerCase(), t[1]);
break;
case DATA: