Tabnine Logo
FileUtils$FileCopyResult.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.druid.java.util.common.FileUtils$FileCopyResult
constructor

Best Java code snippets using org.apache.druid.java.util.common.FileUtils$FileCopyResult.<init> (Showing top 14 results out of 315)

origin: apache/incubator-druid

/**
 * Unzip from the input stream to the output directory, using the entry's file name as the file name in the output directory.
 * The behavior of directories in the input stream's zip is undefined.
 * If possible, it is recommended to use unzip(ByteStream, File) instead
 *
 * @param in     The input stream of the zip data. This stream is closed
 * @param outDir The directory to copy the unzipped data to
 *
 * @return The FileUtils.FileCopyResult containing information on all the files which were written
 *
 * @throws IOException
 */
public static FileUtils.FileCopyResult unzip(InputStream in, File outDir) throws IOException
{
 try (final ZipInputStream zipIn = new ZipInputStream(in)) {
  final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
  ZipEntry entry;
  while ((entry = zipIn.getNextEntry()) != null) {
   final File file = new File(outDir, entry.getName());
   validateZipOutputFile("", file, outDir);
   NativeIO.chunkedCopy(zipIn, file);
   result.addFile(file);
   zipIn.closeEntry();
  }
  return result;
 }
}
origin: apache/incubator-druid

final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
try (final ZipFile zipFile = new ZipFile(pulledFile)) {
 final Enumeration<? extends ZipEntry> enumeration = zipFile.entries();
origin: apache/incubator-druid

    .call();
 return new FileUtils.FileCopyResult(tmpFile);
},
Predicates.alwaysTrue(),
origin: org.apache.druid/druid-server

if (sourceFile.equals(dir)) {
 log.info("Asked to load [%s] into itself, done!", dir);
 return new FileUtils.FileCopyResult(sourceFile);
 throw new SegmentLoadingException("No files found in [%s]", sourceFile.getAbsolutePath());
final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult(sourceFile);
for (final File oldFile : files) {
 if (oldFile.isDirectory()) {
origin: org.apache.druid/java-util

final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
try (final ZipFile zipFile = new ZipFile(pulledFile)) {
 final Enumeration<? extends ZipEntry> enumeration = zipFile.entries();
origin: org.apache.druid/java-util

/**
 * Copy input byte source to outFile. If outFile exists, it is attempted to be deleted.
 *
 * @param byteSource  Supplier for an input stream that is to be copied. The resulting stream is closed each iteration
 * @param outFile     Where the file should be written to.
 * @param shouldRetry Predicate indicating if an error is recoverable and should be retried.
 * @param maxAttempts The maximum number of assumed recoverable attempts to try before completely failing.
 *
 * @throws RuntimeException wrapping the inner exception on failure.
 */
public static FileCopyResult retryCopy(
  final ByteSource byteSource,
  final File outFile,
  final Predicate<Throwable> shouldRetry,
  final int maxAttempts
)
{
 try {
  StreamUtils.retryCopy(
    byteSource,
    Files.asByteSink(outFile),
    shouldRetry,
    maxAttempts
  );
  return new FileCopyResult(outFile);
 }
 catch (Exception e) {
  throw Throwables.propagate(e);
 }
}
origin: org.apache.druid/java-util

/**
 * Unzip from the input stream to the output directory, using the entry's file name as the file name in the output directory.
 * The behavior of directories in the input stream's zip is undefined.
 * If possible, it is recommended to use unzip(ByteStream, File) instead
 *
 * @param in     The input stream of the zip data. This stream is closed
 * @param outDir The directory to copy the unzipped data to
 *
 * @return The FileUtils.FileCopyResult containing information on all the files which were written
 *
 * @throws IOException
 */
public static FileUtils.FileCopyResult unzip(InputStream in, File outDir) throws IOException
{
 try (final ZipInputStream zipIn = new ZipInputStream(in)) {
  final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
  ZipEntry entry;
  while ((entry = zipIn.getNextEntry()) != null) {
   final File file = new File(outDir, entry.getName());
   validateZipOutputFile("", file, outDir);
   NativeIO.chunkedCopy(zipIn, file);
   result.addFile(file);
   zipIn.closeEntry();
  }
  return result;
 }
}
origin: org.apache.druid/java-util

/**
 * Unzips the input stream via a gzip filter. use gunzip(ByteSource, File, Predicate) if possible
 *
 * @param in      The input stream to run through the gunzip filter. This stream is closed
 * @param outFile The file to output to
 *
 * @throws IOException
 */
public static FileUtils.FileCopyResult gunzip(InputStream in, File outFile) throws IOException
{
 try (GZIPInputStream gzipInputStream = gzipInputStream(in)) {
  NativeIO.chunkedCopy(gzipInputStream, outFile);
  return new FileUtils.FileCopyResult(outFile);
 }
}
origin: org.apache.druid/java-util

/**
 * Gzips the input file to the output
 *
 * @param inFile      The file to gzip
 * @param outFile     A target file to copy the uncompressed contents of inFile to
 * @param shouldRetry Predicate on a potential throwable to determine if the copy should be attempted again.
 *
 * @return The result of the file copy
 *
 * @throws IOException
 */
public static FileUtils.FileCopyResult gzip(final File inFile, final File outFile, Predicate<Throwable> shouldRetry)
{
 gzip(Files.asByteSource(inFile), Files.asByteSink(outFile), shouldRetry);
 return new FileUtils.FileCopyResult(outFile);
}
origin: apache/incubator-druid

final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult();
while (children.hasNext()) {
 final LocatedFileStatus child = children.next();
origin: apache/incubator-druid

if (sourceFile.equals(dir)) {
 log.info("Asked to load [%s] into itself, done!", dir);
 return new FileUtils.FileCopyResult(sourceFile);
 throw new SegmentLoadingException("No files found in [%s]", sourceFile.getAbsolutePath());
final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult(sourceFile);
for (final File oldFile : files) {
 if (oldFile.isDirectory()) {
origin: apache/incubator-druid

/**
 * Copy input byte source to outFile. If outFile exists, it is attempted to be deleted.
 *
 * @param byteSource  Supplier for an input stream that is to be copied. The resulting stream is closed each iteration
 * @param outFile     Where the file should be written to.
 * @param shouldRetry Predicate indicating if an error is recoverable and should be retried.
 * @param maxAttempts The maximum number of assumed recoverable attempts to try before completely failing.
 *
 * @throws RuntimeException wrapping the inner exception on failure.
 */
public static FileCopyResult retryCopy(
  final ByteSource byteSource,
  final File outFile,
  final Predicate<Throwable> shouldRetry,
  final int maxAttempts
)
{
 try {
  StreamUtils.retryCopy(
    byteSource,
    Files.asByteSink(outFile),
    shouldRetry,
    maxAttempts
  );
  return new FileCopyResult(outFile);
 }
 catch (Exception e) {
  throw Throwables.propagate(e);
 }
}
origin: apache/incubator-druid

/**
 * Unzips the input stream via a gzip filter. use gunzip(ByteSource, File, Predicate) if possible
 *
 * @param in      The input stream to run through the gunzip filter. This stream is closed
 * @param outFile The file to output to
 *
 * @throws IOException
 */
public static FileUtils.FileCopyResult gunzip(InputStream in, File outFile) throws IOException
{
 try (GZIPInputStream gzipInputStream = gzipInputStream(in)) {
  NativeIO.chunkedCopy(gzipInputStream, outFile);
  return new FileUtils.FileCopyResult(outFile);
 }
}
origin: apache/incubator-druid

/**
 * Gzips the input file to the output
 *
 * @param inFile      The file to gzip
 * @param outFile     A target file to copy the uncompressed contents of inFile to
 * @param shouldRetry Predicate on a potential throwable to determine if the copy should be attempted again.
 *
 * @return The result of the file copy
 *
 * @throws IOException
 */
public static FileUtils.FileCopyResult gzip(final File inFile, final File outFile, Predicate<Throwable> shouldRetry)
{
 gzip(Files.asByteSource(inFile), Files.asByteSink(outFile), shouldRetry);
 return new FileUtils.FileCopyResult(outFile);
}
org.apache.druid.java.util.commonFileUtils$FileCopyResult<init>

Popular methods of FileUtils$FileCopyResult

  • size
  • addFile
  • addFiles
  • getFiles
  • addSizedFiles

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • addToBackStack (FragmentTransaction)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • JFileChooser (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best plugins for Eclipse
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