Programming Tips - How do I read the content from a Part?

Date: 2014aug26 Language: Java Platform: Servlet Q. How do I read the content from a Part? A. Here's method for that:
String readContent(Part part) throws IOException { InputStream is = part.getInputStream(); final int n = is.available(); byte [] bytes = new byte[n]; // Allocate room is.read(bytes, 0, n); return new String(bytes, "UTF-8"); }