Tabnine Logo
IOUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
IOUtils
in
org.apache.sanselan.util

Best Java code snippets using org.apache.sanselan.util.IOUtils (Showing top 10 results out of 315)

origin: Haehnchen/idea-php-symfony2-plugin

@Override
public void build(@NotNull Project project, @NotNull Collection<FileObject> fileObjects) {
  Collection<InputStream> memoryCache = new ArrayList<>();
  for (FileObject fileObject : fileObjects) {
    InputStream inputStream;
    try {
      // copy stream
      inputStream = new ResetOnCloseInputStream(new ByteArrayInputStream(
        IOUtils.getInputStreamBytes(fileObject.getContent().getInputStream()))
      );
    } catch (FileSystemException ignored) {
      continue;
    } catch (IOException ignored) {
      continue;
    }
    memoryCache.add(inputStream);
  }
  storage = new ServiceParameterStorage(memoryCache);
}
origin: org.apache.sanselan/sanselan

public static void copyStreamToStream(InputStream src, OutputStream dst)
    throws IOException
{
  copyStreamToStream(src, dst, true);
}
origin: org.apache.sanselan/sanselan

public static void writeToFile(byte[] src, File file) throws IOException
{
  ByteArrayInputStream stream = null;
  try
  {
    stream = new ByteArrayInputStream(src);
    putInputStreamToFile(stream, file);
  } finally
  {
    try
    {
      if (stream != null)
        stream.close();
    } catch (Exception e)
    {
      Debug.debug(e);
    }
  }
}
origin: liias/monkey

@NotNull
private Map<MonkeyType, MonkeyType> readSettingsFile(File settingsFile) throws IOException {
 byte[] fileBytes = IOUtils.getFileBytes(settingsFile);
 Deserializer deserializer = new Deserializer(fileBytes);
 Optional<MonkeyTypeHash> settings = deserializer.getTypes()
  .stream()
  .filter(monkeyType -> monkeyType instanceof MonkeyTypeHash)
  .map(monkeyType -> (MonkeyTypeHash) monkeyType)
  .findFirst();
 return settings.map(MonkeyTypeHash::getItems).orElse(new HashMap<>());
}
origin: fr.opensagres.xdocreport.appengine-awt/appengine-awt

public static void writeToFile(byte[] src, File file) throws IOException
{
  ByteArrayInputStream stream = null;
  try
  {
    stream = new ByteArrayInputStream(src);
    putInputStreamToFile(stream, file);
  } finally
  {
    try
    {
      if (stream != null)
        stream.close();
    } catch (Exception e)
    {
      Debug.debug(e);
    }
  }
}
origin: org.apache.sanselan/sanselan

/**
 * Reads a File into memory.
 * <p>
 * 
 * @param file
 *            The File to read.
 * @return A byte array containing the contents of the File
 * @see InputStream
 */
public static byte[] getFileBytes(File file) throws IOException
{
  InputStream is = null;
  try
  {
    is = new FileInputStream(file);
    return getInputStreamBytes(is);
  } finally
  {
    try
    {
      if (is != null)
        is.close();
    } catch (IOException e)
    {
      Debug.debug(e);
    }
  }
}
origin: fr.opensagres.xdocreport.appengine-awt/appengine-awt

public static void copyStreamToStream(InputStream src, OutputStream dst)
    throws IOException
{
  copyStreamToStream(src, dst, true);
}
origin: fr.opensagres.xdocreport.appengine-awt/appengine-awt

/**
 * Reads a File into memory.
 * <p>
 *
 * @param file
 *            The File to read.
 * @return A byte array containing the contents of the File
 * @see InputStream
 */
public static byte[] getFileBytes(File file) throws IOException
{
  InputStream is = null;
  try
  {
    is = new FileInputStream(file);
    return getInputStreamBytes(is);
  } finally
  {
    try
    {
      if (is != null)
        is.close();
    } catch (IOException e)
    {
      Debug.debug(e);
    }
  }
}
origin: org.apache.sanselan/sanselan

public static void putInputStreamToFile(InputStream src, File file)
    throws IOException
{
  FileOutputStream stream = null;
  try
  {
    if (file.getParentFile() != null)
      file.getParentFile().mkdirs();
    stream = new FileOutputStream(file);
    copyStreamToStream(src, stream);
  } finally
  {
    try
    {
      if (stream != null)
        stream.close();
    } catch (Exception e)
    {
      Debug.debug(e);
    }
  }
}
origin: fr.opensagres.xdocreport.appengine-awt/appengine-awt

public static void putInputStreamToFile(InputStream src, File file)
    throws IOException
{
  FileOutputStream stream = null;
  try
  {
    if (file.getParentFile() != null)
      file.getParentFile().mkdirs();
    stream = new FileOutputStream(file);
    copyStreamToStream(src, stream);
  } finally
  {
    try
    {
      if (stream != null)
        stream.close();
    } catch (Exception e)
    {
      Debug.debug(e);
    }
  }
}
org.apache.sanselan.utilIOUtils

Most used methods

  • getInputStreamBytes
    Reads an InputStream to the end.
  • copyStreamToStream
  • putInputStreamToFile
  • getFileBytes
    Reads a File into memory.

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • JCheckBox (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Github Copilot alternatives
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