/** * Returns the original filename in the client's filesystem. * * @return The original filename in the client's filesystem. * @throws org.apache.tomcat.util.http.fileupload.InvalidFileNameException * The file name contains a NUL character, which might be an indicator of * a security attack. If you intend to use the file name anyways, catch * the exception and use InvalidFileNameException#getName(). */ public String getName() { return Streams.checkFileName(fileName); }
/** * Copies the contents of the given {@link InputStream} * to the given {@link OutputStream}. Shortcut for * <pre> * copy(pInputStream, pOutputStream, new byte[8192]); * </pre> * * @param inputStream The input stream, which is being read. * It is guaranteed, that {@link InputStream#close()} is called * on the stream. * @param outputStream The output stream, to which data should * be written. May be null, in which case the input streams * contents are simply discarded. * @param closeOutputStream True guarantees, that {@link OutputStream#close()} * is called on the stream. False indicates, that only * {@link OutputStream#flush()} should be called finally. * * @return Number of bytes, which have been copied. * @throws IOException An I/O error occurred. */ public static long copy(InputStream inputStream, OutputStream outputStream, boolean closeOutputStream) throws IOException { return copy(inputStream, outputStream, closeOutputStream, new byte[DEFAULT_BUFFER_SIZE]); }
List<String> getProjectMaintainers(RepositoryWrapper repository) { try { return Lists.newArrayList(Streams.asString(repository.getFileContent("MAINTAINERS")).split("\n")); } catch (IOException ioe) { return Collections.emptyList(); } }
/** * Copies the contents of the given {@link InputStream} * to the given {@link OutputStream}. Shortcut for * <pre> * copy(pInputStream, pOutputStream, new byte[8192]); * </pre> * @param pInputStream The input stream, which is being read. * It is guaranteed, that {@link InputStream#close()} is called * on the stream. * @param pOutputStream The output stream, to which data should * be written. May be null, in which case the input streams * contents are simply discarded. * @param pClose True guarantees, that {@link OutputStream#close()} * is called on the stream. False indicates, that only * {@link OutputStream#flush()} should be called finally. * * @return Number of bytes, which have been copied. * @throws IOException An I/O error occurred. */ public static long copy(InputStream pInputStream, OutputStream pOutputStream, boolean pClose) throws IOException { return copy(pInputStream, pOutputStream, pClose, new byte[DEFAULT_BUFFER_SIZE]); }
/** * Returns the original filename in the client's filesystem. * * @return The original filename in the client's filesystem. * @throws InvalidFileNameException The file name contains a NUL character, * which might be an indicator of a security attack. If you intend to * use the file name anyways, catch the exception and use * InvalidFileNameException#getName(). */ public String getName() { return Streams.checkFileName(fileName); }
/** * Copies the contents of the given {@link InputStream} * to the given {@link OutputStream}. Shortcut for * <pre> * copy(pInputStream, pOutputStream, new byte[8192]); * </pre> * @param pInputStream The input stream, which is being read. * It is guaranteed, that {@link InputStream#close()} is called * on the stream. * @param pOutputStream The output stream, to which data should * be written. May be null, in which case the input streams * contents are simply discarded. * @param pClose True guarantees, that {@link OutputStream#close()} * is called on the stream. False indicates, that only * {@link OutputStream#flush()} should be called finally. * * @return Number of bytes, which have been copied. * @throws IOException An I/O error occurred. */ public static long copy(InputStream pInputStream, OutputStream pOutputStream, boolean pClose) throws IOException { return copy(pInputStream, pOutputStream, pClose, new byte[DEFAULT_BUFFER_SIZE]); }
/** * Returns the items file name. * @return File name, if known, or null. * @throws InvalidFileNameException The file name contains a NUL character, * which might be an indicator of a security attack. If you intend to * use the file name anyways, catch the exception and use * InvalidFileNameException#getName(). */ @Override public String getName() { return Streams.checkFileName(name); }
/** * Copies the contents of the given {@link InputStream} * to the given {@link OutputStream}. Shortcut for * <pre> * copy(pInputStream, pOutputStream, new byte[8192]); * </pre> * @param pInputStream The input stream, which is being read. * It is guaranteed, that {@link InputStream#close()} is called * on the stream. * @param pOutputStream The output stream, to which data should * be written. May be null, in which case the input streams * contents are simply discarded. * @param pClose True guarantees, that {@link OutputStream#close()} * is called on the stream. False indicates, that only * {@link OutputStream#flush()} should be called finally. * * @return Number of bytes, which have been copied. * @throws IOException An I/O error occurred. */ public static long copy(InputStream pInputStream, OutputStream pOutputStream, boolean pClose) throws IOException { return copy(pInputStream, pOutputStream, pClose, new byte[DEFAULT_BUFFER_SIZE]); }
/** * Returns the items file name. * @return File name, if known, or null. * @throws InvalidFileNameException The file name contains a NUL character, * which might be an indicator of a security attack. If you intend to * use the file name anyways, catch the exception and use * InvalidFileNameException#getName(). */ public String getName() { return Streams.checkFileName(name); }
/** * Copies the contents of the given {@link InputStream} * to the given {@link OutputStream}. Shortcut for * <pre> * copy(pInputStream, pOutputStream, new byte[8192]); * </pre> * * @param pInputStream The input stream, which is being read. * It is guaranteed, that {@link InputStream#close()} is called * on the stream. * @param pOutputStream The output stream, to which data should * be written. May be null, in which case the input streams * contents are simply discarded. * @param pClose True guarantees, that {@link OutputStream#close()} * is called on the stream. False indicates, that only * {@link OutputStream#flush()} should be called finally. * * @return Number of bytes, which have been copied. * @throws IOException An I/O error occurred. */ public static long copy(InputStream pInputStream, OutputStream pOutputStream, boolean pClose) throws IOException { return copy(pInputStream, pOutputStream, pClose, new byte[DEFAULT_BUFFER_SIZE]); }
/** * Returns the items file name. * @return File name, if known, or null. * @throws InvalidFileNameException The file name contains a NUL character, * which might be an indicator of a security attack. If you intend to * use the file name anyways, catch the exception and use * InvalidFileNameException#getName(). */ public String getName() { return Streams.checkFileName(name); }
/** * Copies the contents of the given {@link InputStream} * to the given {@link OutputStream}. Shortcut for * <pre> * copy(pInputStream, pOutputStream, new byte[8192]); * </pre> * * @param pInputStream The input stream, which is being read. * It is guaranteed, that {@link InputStream#close()} is called * on the stream. * @param pOutputStream The output stream, to which data should * be written. May be null, in which case the input streams * contents are simply discarded. * @param pClose True guarantees, that {@link OutputStream#close()} * is called on the stream. False indicates, that only * {@link OutputStream#flush()} should be called finally. * * @return Number of bytes, which have been copied. * @throws IOException An I/O error occurred. */ public static long copy(InputStream pInputStream, OutputStream pOutputStream, boolean pClose) throws IOException { return copy(pInputStream, pOutputStream, pClose, new byte[DEFAULT_BUFFER_SIZE]); }
/** * Returns the items file name. * * @return File name, if known, or null. * @throws InvalidFileNameException The file name contains a NUL character, * which might be an indicator of a security attack. If you intend to * use the file name anyways, catch the exception and use * InvalidFileNameException#getName(). */ @Override public String getName() { return Streams.checkFileName(name); }
/** * This convenience method allows to read a * {@link org.apache.tomcat.util.http.fileupload.FileItemStream}'s * content into a string. The platform's default character encoding * is used for converting bytes into characters. * @param pStream The input stream to read. * @see #asString(InputStream, String) * @return The streams contents, as a string. * @throws IOException An I/O error occurred. */ public static String asString(InputStream pStream) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(pStream, baos, true); return baos.toString(); }
/** * Returns the items file name. * * @return File name, if known, or null. * @throws InvalidFileNameException The file name contains a NUL character, * which might be an indicator of a security attack. If you intend to * use the file name anyways, catch the exception and use * InvalidFileNameException#getName(). */ @Override public String getName() { return Streams.checkFileName(name); }
/** * This convenience method allows to read a * {@link org.apache.tomcat.util.http.fileupload.FileItemStream}'s * content into a string. The platform's default character encoding * is used for converting bytes into characters. * @param pStream The input stream to read. * @see #asString(InputStream, String) * @return The streams contents, as a string. * @throws IOException An I/O error occurred. */ public static String asString(InputStream pStream) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(pStream, baos, true); return baos.toString(); }
/** * Returns the original filename in the client's filesystem. * * @return The original filename in the client's filesystem. * @throws org.apache.tomcat.util.http.fileupload.InvalidFileNameException * The file name contains a NUL character, which might be an indicator of * a security attack. If you intend to use the file name anyways, catch * the exception and use InvalidFileNameException#getName(). */ @Override public String getName() { return Streams.checkFileName(fileName); }
/** * This convenience method allows to read a * {@link org.apache.tomcat.util.http.fileupload.FileItemStream}'s * content into a string. The platform's default character encoding * is used for converting bytes into characters. * @param pStream The input stream to read. * @see #asString(InputStream, String) * @return The streams contents, as a string. * @throws IOException An I/O error occurred. */ public static String asString(InputStream pStream) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(pStream, baos, true); return baos.toString(); }
/** * Returns the items file name. * * @return File name, if known, or null. * @throws InvalidFileNameException The file name contains a NUL character, * which might be an indicator of a security attack. If you intend to * use the file name anyways, catch the exception and use * InvalidFileNameException#getName(). */ @Override public String getName() { return Streams.checkFileName(name); }
/** * This convenience method allows to read a * {@link org.apache.tomcat.util.http.fileupload.FileItemStream}'s * content into a string. The platform's default character encoding * is used for converting bytes into characters. * * @param pStream The input stream to read. * @see #asString(InputStream, String) * @return The streams contents, as a string. * @throws IOException An I/O error occurred. */ public static String asString(InputStream pStream) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(pStream, baos, true); return baos.toString(); }