Tabnine Logo
DiskFileItem.isInMemory
Code IndexAdd Tabnine to your IDE (free)

How to use
isInMemory
method
in
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem

Best Java code snippets using org.apache.tomcat.util.http.fileupload.disk.DiskFileItem.isInMemory (Showing top 20 results out of 315)

origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Deletes the underlying storage for a file item, including deleting any
 * associated temporary disk file. Although this storage will be deleted
 * automatically when the <code>FileItem</code> instance is garbage
 * collected, this method can be used to ensure that this is done at an
 * earlier time, thus preserving system resources.
 */
@Override
public void delete() {
  cachedContent = null;
  File outputFile = getStoreLocation();
  if (outputFile != null && !isInMemory() && outputFile.exists()) {
    outputFile.delete();
  }
}
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Returns the {@link java.io.File} object for the <code>FileItem</code>'s
 * data's temporary location on the disk. Note that for
 * <code>FileItem</code>s that have their data stored in memory,
 * this method will return <code>null</code>. When handling large
 * files, you can use {@link java.io.File#renameTo(java.io.File)} to
 * move the file to new location without copying the data, if the
 * source and destination locations reside within the same logical
 * volume.
 *
 * @return The data file, or <code>null</code> if the data is stored in
 *         memory.
 */
public File getStoreLocation() {
  if (dfos == null) {
    return null;
  }
  if (isInMemory()) {
    return null;
  }
  return dfos.getFile();
}
origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Returns an {@link java.io.InputStream InputStream} that can be
 * used to retrieve the contents of the file.
 *
 * @return An {@link java.io.InputStream InputStream} that can be
 *         used to retrieve the contents of the file.
 *
 * @throws IOException if an error occurs.
 */
public InputStream getInputStream()
  throws IOException {
  if (!isInMemory()) {
    return new FileInputStream(dfos.getFile());
  }
  if (cachedContent == null) {
    cachedContent = dfos.getData();
  }
  return new ByteArrayInputStream(cachedContent);
}
origin: org.jboss.web/jbossweb

/**
 * Returns an {@link java.io.InputStream InputStream} that can be
 * used to retrieve the contents of the file.
 *
 * @return An {@link java.io.InputStream InputStream} that can be
 *         used to retrieve the contents of the file.
 *
 * @throws IOException if an error occurs.
 */
public InputStream getInputStream()
  throws IOException {
  if (!isInMemory()) {
    return new FileInputStream(dfos.getFile());
  }
  if (cachedContent == null) {
    cachedContent = dfos.getData();
  }
  return new ByteArrayInputStream(cachedContent);
}
origin: org.apache.geronimo.ext.tomcat/util

/**
 * Returns an {@link java.io.InputStream InputStream} that can be
 * used to retrieve the contents of the file.
 *
 * @return An {@link java.io.InputStream InputStream} that can be
 *         used to retrieve the contents of the file.
 *
 * @throws IOException if an error occurs.
 */
@Override
public InputStream getInputStream()
  throws IOException {
  if (!isInMemory()) {
    return new FileInputStream(dfos.getFile());
  }
  if (cachedContent == null) {
    cachedContent = dfos.getData();
  }
  return new ByteArrayInputStream(cachedContent);
}
origin: codefollower/Tomcat-Research

/**
 * Returns an {@link java.io.InputStream InputStream} that can be
 * used to retrieve the contents of the file.
 *
 * @return An {@link java.io.InputStream InputStream} that can be
 *         used to retrieve the contents of the file.
 *
 * @throws IOException if an error occurs.
 */
@Override
public InputStream getInputStream()
  throws IOException {
  if (!isInMemory()) {
    return new FileInputStream(dfos.getFile());
  }
  if (cachedContent == null) {
    cachedContent = dfos.getData();
  }
  return new ByteArrayInputStream(cachedContent);
}
origin: org.apache.coyote/com.springsource.org.apache.coyote

/**
 * Returns an {@link java.io.InputStream InputStream} that can be
 * used to retrieve the contents of the file.
 *
 * @return An {@link java.io.InputStream InputStream} that can be
 *         used to retrieve the contents of the file.
 *
 * @throws IOException if an error occurs.
 */
@Override
public InputStream getInputStream()
  throws IOException {
  if (!isInMemory()) {
    return new FileInputStream(dfos.getFile());
  }
  if (cachedContent == null) {
    cachedContent = dfos.getData();
  }
  return new ByteArrayInputStream(cachedContent);
}
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Returns an {@link java.io.InputStream InputStream} that can be
 * used to retrieve the contents of the file.
 *
 * @return An {@link java.io.InputStream InputStream} that can be
 *         used to retrieve the contents of the file.
 *
 * @throws IOException if an error occurs.
 */
@Override
public InputStream getInputStream()
  throws IOException {
  if (!isInMemory()) {
    return new FileInputStream(dfos.getFile());
  }
  if (cachedContent == null) {
    cachedContent = dfos.getData();
  }
  return new ByteArrayInputStream(cachedContent);
}
origin: org.apache.geronimo.ext.tomcat/util

if (isInMemory()) {
  if (cachedContent == null) {
    cachedContent = dfos.getData();
origin: codefollower/Tomcat-Research

if (isInMemory()) {
  if (cachedContent == null) {
    cachedContent = dfos.getData();
origin: com.ovea.tajin.server/tajin-server-tomcat7

if (isInMemory()) {
  if (cachedContent == null) {
    cachedContent = dfos.getData();
origin: org.jboss.web/jbossweb

if (isInMemory()) {
  if (cachedContent == null) {
    cachedContent = dfos.getData();
origin: org.apache.coyote/com.springsource.org.apache.coyote

if (isInMemory()) {
  if (cachedContent == null) {
    cachedContent = dfos.getData();
origin: org.apache.geronimo.ext.tomcat/util

if (isInMemory()) {
  FileOutputStream fout = null;
  try {
origin: codefollower/Tomcat-Research

if (isInMemory()) {
  FileOutputStream fout = null;
  try {
origin: com.ovea.tajin.server/tajin-server-tomcat7

if (isInMemory()) {
  FileOutputStream fout = null;
  try {
origin: org.apache.coyote/com.springsource.org.apache.coyote

if (isInMemory()) {
  FileOutputStream fout = null;
  try {
origin: org.jboss.web/jbossweb

if (isInMemory()) {
  FileOutputStream fout = null;
  try {
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

if (isInMemory()) {
  FileOutputStream fout = null;
  try {
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Returns the contents of the file as an array of bytes.  If the
 * contents of the file were not yet cached in memory, they will be
 * loaded from the disk storage and cached.
 *
 * @return The contents of the file as an array of bytes
 * or {@code null} if the data cannot be read
 */
@Override
public byte[] get() {
  if (isInMemory()) {
    if (cachedContent == null && dfos != null) {
      cachedContent = dfos.getData();
    }
    return cachedContent;
  }
  byte[] fileData = new byte[(int) getSize()];
  InputStream fis = null;
  try {
    fis = new FileInputStream(dfos.getFile());
    IOUtils.readFully(fis, fileData);
  } catch (IOException e) {
    fileData = null;
  } finally {
    IOUtils.closeQuietly(fis);
  }
  return fileData;
}
org.apache.tomcat.util.http.fileupload.diskDiskFileItemisInMemory

Javadoc

Provides a hint as to whether or not the file contents will be read from memory.

Popular methods of DiskFileItem

  • getHeaders
    Returns the file item headers.
  • getStoreLocation
    Returns the java.io.File object for the FileItem's data's temporary location on the disk. Note that
  • <init>
    Constructs a new DiskFileItem instance.
  • get
    Returns the contents of the file as an array of bytes. If the contents of the file were not yet cach
  • getCharSet
    Returns the content charset passed by the agent or null if not defined.
  • getContentType
    Returns the content type passed by the agent or null if not defined.
  • getFieldName
    Returns the name of the field in the multipart form corresponding to this file item.
  • getName
    Returns the original filename in the client's filesystem.
  • getSize
    Returns the size of the file.
  • getTempFile
    Creates and returns a java.io.File representing a uniquely named temporary file in the configured re
  • getUniqueId
    Returns an identifier that is unique within the class loader used to load this class, but does not h
  • isFormField
    Determines whether or not a FileItem instance represents a simple form field.
  • getUniqueId,
  • isFormField,
  • getOutputStream,
  • getString,
  • setDefaultCharset

Popular in Java

  • Reading from database using SQL prepared statement
  • getSharedPreferences (Context)
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • JPanel (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now