/** * Appends {@link jodd.http.up.Uploadable} to buffer. */ public Buffer append(final Uploadable uploadable) { list.add(uploadable); size += uploadable.getSize(); last = null; return this; }
/** * Writes content to the writer. */ public void writeTo(final Writer writer) throws IOException { for (Object o : list) { if (o instanceof FastByteBuffer) { FastByteBuffer fastByteBuffer = (FastByteBuffer) o; byte[] array = fastByteBuffer.toArray(); writer.write(new String(array, StringPool.ISO_8859_1)); } else if (o instanceof Uploadable) { Uploadable uploadable = (Uploadable) o; InputStream inputStream = uploadable.openInputStream(); try { StreamUtil.copy(inputStream, writer, StringPool.ISO_8859_1); } finally { StreamUtil.close(inputStream); } } } }
Uploadable uploadable = (Uploadable) o; InputStream inputStream = uploadable.openInputStream(); int remaining = uploadable.getSize();
Uploadable uploadable = (Uploadable) value; String fileName = uploadable.getFileName(); if (fileName == null) { fileName = name; buffer.append("\"; filename=\"").append(fileName).append('"').append(CRLF); String mimeType = uploadable.getMimeType(); if (mimeType == null) { mimeType = MimeTypes.getMimeType(FileNameUtil.getExtension(fileName));
Uploadable uploadable = (Uploadable) o; InputStream inputStream = uploadable.openInputStream(); int remaining = uploadable.getSize();
Uploadable uploadable = (Uploadable) value; String fileName = uploadable.getFileName(); if (fileName == null) { fileName = name; buffer.append("\"; filename=\"").append(fileName).append('"').append(CRLF); String mimeType = uploadable.getMimeType(); if (mimeType == null) { mimeType = MimeTypes.getMimeType(FileNameUtil.getExtension(fileName));
/** * Writes content to the output stream. */ public void writeTo(final OutputStream out) throws IOException { for (Object o : list) { if (o instanceof FastByteBuffer) { FastByteBuffer fastByteBuffer = (FastByteBuffer) o; out.write(fastByteBuffer.toArray()); } else if (o instanceof Uploadable) { Uploadable uploadable = (Uploadable) o; InputStream inputStream = uploadable.openInputStream(); try { StreamUtil.copy(inputStream, out); } finally { StreamUtil.close(inputStream); } } } }
/** * Appends {@link jodd.http.up.Uploadable} to buffer. */ public Buffer append(final Uploadable uploadable) { list.add(uploadable); size += uploadable.getSize(); last = null; return this; }
/** * Writes content to the writer. */ public void writeTo(final Writer writer) throws IOException { for (Object o : list) { if (o instanceof FastByteBuffer) { FastByteBuffer fastByteBuffer = (FastByteBuffer) o; byte[] array = fastByteBuffer.toArray(); writer.write(new String(array, StringPool.ISO_8859_1)); } else if (o instanceof Uploadable) { Uploadable uploadable = (Uploadable) o; InputStream inputStream = uploadable.openInputStream(); try { StreamUtil.copy(inputStream, writer, StringPool.ISO_8859_1); } finally { StreamUtil.close(inputStream); } } } }
/** * Writes content to the output stream. */ public void writeTo(final OutputStream out) throws IOException { for (Object o : list) { if (o instanceof FastByteBuffer) { FastByteBuffer fastByteBuffer = (FastByteBuffer) o; out.write(fastByteBuffer.toArray()); } else if (o instanceof Uploadable) { Uploadable uploadable = (Uploadable) o; InputStream inputStream = uploadable.openInputStream(); try { StreamUtil.copy(inputStream, out); } finally { StreamUtil.close(inputStream); } } } }