processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/LimitedTemporaryStorage.java
/**
   * Create a new temporary file. All methods of the returned output stream may throw
   * {@link TemporaryStorageFullException} if the temporary storage area fills up.
   *
   * @return output stream to the file
   *
   * @throws TemporaryStorageFullException if the temporary storage area is full
   * @throws IOException                   if something goes wrong while creating the file
   */
Create a new temporary file. All methods of the returned output stream may throw
TemporaryStorageFullException if the temporary storage area fills up.

@return output stream to the file

@throws TemporaryStorageFullException if the temporary storage area is full
@throws IOException                   if something goes wrong while creating the file
Create a new temporary file . All methods of the returned output stream may throw TemporaryStorageFullException if the temporary storage area fills up . @return output stream to the file @throws TemporaryStorageFullException if the temporary storage area is full @throws IOException if something goes wrong while creating the file
public LimitedOutputStream createFile() throws IOException
  {
    if (bytesUsed.get() >= maxBytesUsed) {
      throw new TemporaryStorageFullException(maxBytesUsed);
    }
    synchronized (files) {
      if (closed) {
        throw new ISE("Closed");
      }
      FileUtils.mkdirp(storageDirectory);
      if (!createdStorageDirectory) {
        createdStorageDirectory = true;
      }
      final File theFile = new File(storageDirectory, StringUtils.format("%08d.tmp", files.size()));
      final EnumSet<StandardOpenOption> openOptions = EnumSet.of(
          StandardOpenOption.CREATE_NEW,
          StandardOpenOption.WRITE
      );
      final FileChannel channel = FileChannel.open(theFile.toPath(), openOptions);
      files.add(theFile);
      return new LimitedOutputStream(theFile, Channels.newOutputStream(channel));
    }
  }
public LimitedOutputStream createFile ( ) throws IOException { if ( bytesUsed . get ( ) >= maxBytesUsed ) { throw new TemporaryStorageFullException ( maxBytesUsed ) ; } synchronized ( files ) { if ( closed ) { throw new ISE ( "Closed" ) ; } FileUtils . mkdirp ( storageDirectory ) ; if ( ! createdStorageDirectory ) { createdStorageDirectory = true ; } final File theFile = new File ( storageDirectory , StringUtils . format ( "%08d.tmp" , files . size ( ) ) ) ; final EnumSet < StandardOpenOption > openOptions = EnumSet . of ( StandardOpenOption . CREATE_NEW , StandardOpenOption . WRITE ) ; final FileChannel channel = FileChannel . open ( theFile . toPath ( ) , openOptions ) ; files . add ( theFile ) ; return new LimitedOutputStream ( theFile , Channels . newOutputStream ( channel ) ) ; } }
Create a new temporary file.
Create a new temporary file .