code: public static InputStream getContent(ValueStoragePlugin plugin, ValueData value, String resourceId, boolean spoolContent)
        throws IOException
     {
        if (value.isByteArray())
        {
           return new ByteArrayInputStream(value.getAsByteArray());
        }
        else if (value instanceof StreamPersistedValueData)
        {
           StreamPersistedValueData streamed = (StreamPersistedValueData)value;
           if (!streamed.isPersisted())
           {
              InputStream stream;
              // the Value not yet persisted, i.e. or in client stream or spooled to a temp file
              File tempFile;
              if ((tempFile = streamed.getTempFile()) != null)
              {
                 // it's spooled Value, try move its file to VS
                 stream = new FileInputStream(tempFile);
              }
              else
              {
                 // not spooled, use client InputStream
                 stream = streamed.getStream();
              }
              // link this Value to URL in VS
              InputStream result = streamed.setPersistedURL(plugin.createURL(resourceId), spoolContent);
              return result != null ? result : stream;
           }
        }
        return value.getAsStream();
     }
docs: Extracts the content of the given {@link ValueData} and links the data to
  the {@link URL} in the Value Storage if needed
  @param plugin the plug-in that will manage the storage of the provided {@link ValueData}
  @param value the value from which we want to extract the content
  @param resourceId the internal id of the {@link ValueData}
  @param spoolContent Indicates whether or not the content should always be spooled
  @return the content of the {@link ValueData}
  @throws IOException if the content could not be extracted