public MultipartInput readFrom(Class<MultipartInput> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { String boundary = mediaType.getParameters().get("boundary"); if (boundary == null) throw new IOException(Messages.MESSAGES.unableToGetBoundary()); MultipartInputImpl input = new MultipartInputImpl(mediaType, workers); /* StringWriter writer = new StringWriter(); int b; do { b = entityStream.read(); if (b == -1) break; writer.write(b); } while (b != -1); System.out.println(writer.toString()); */ input.parse(entityStream); return input; } }
@Override public void parse(InputStream is) throws IOException { super.parse(is); ContentTypeField contentTypeField = (ContentTypeField) mimeMessage .getHeader().getField(FieldName.CONTENT_TYPE); start = contentTypeField.getParameter("start"); startInfo = contentTypeField.getParameter("start-info"); type = contentTypeField.getParameter("type"); rootPart = start == null ? getParts().get(0) : relatedMap.get(start); }
parameters); MultipartInputImpl multipart = new MultipartInputImpl(contentType, null); multipart.parse(bais);
input.parse(entityStream);
public MultipartInput readFrom(Class<MultipartInput> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { String boundary = mediaType.getParameters().get("boundary"); if (boundary == null) throw new IOException(Messages.MESSAGES.unableToGetBoundary()); MultipartInputImpl input = new MultipartInputImpl(mediaType, workers); /* StringWriter writer = new StringWriter(); int b; do { b = entityStream.read(); if (b == -1) break; writer.write(b); } while (b != -1); System.out.println(writer.toString()); */ input.parse(entityStream); return input; } }
parameters); MultipartInputImpl multipart = new MultipartInputImpl(contentType, null); multipart.parse(bais);
@Override public void parse(InputStream is) throws IOException { super.parse(is); ContentTypeField contentTypeField = (ContentTypeField) mimeMessage .getHeader().getField(FieldName.CONTENT_TYPE); start = contentTypeField.getParameter("start"); startInfo = contentTypeField.getParameter("start-info"); type = contentTypeField.getParameter("type"); rootPart = start == null ? getParts().get(0) : relatedMap.get(start); }
input.parse(entityStream);