private FileOutputStream fos()

in src/main/java/software/amazon/encryption/s3/internal/MultiFileOutputStream.java [146:164]


    private FileOutputStream fos() throws IOException {
        if (closed) {
            throw new IOException("Output stream is already closed");
        }
        if (os == null || currFileBytesWritten >= partSize) {
            if (os != null) {
                os.close();
                // notify about the new file ready for processing
                observer.onPartCreate(new PartCreationEvent(
                        getFile(filesCreated), filesCreated, false, this));
            }
            currFileBytesWritten = 0;
            filesCreated++;
            blockIfNecessary();
            final File file = getFile(filesCreated);
            os = new FileOutputStream(file);
        }
        return os;
    }