Files
openide/platform/analysis-api/src/com/intellij/modcommand/ModCreateFile.java
Tagir Valeev 2f10b5f14d [mod-commands] IJPL-157211 Support creation of binary files via ModCommand
GitOrigin-RevId: abebbf301426d4d66abeadc4b72afa8dfd041f0e
2024-06-27 11:21:13 +00:00

31 lines
831 B
Java

// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.modcommand;
import org.jetbrains.annotations.NotNull;
/**
* @param file file to create
* @param text file content
*/
public record ModCreateFile(@NotNull FutureVirtualFile file, @NotNull Content content) implements ModCommand {
/**
* New file content
*/
public sealed interface Content {}
/**
* Text content
*
* @param text text to write into the new file. The encoding will be selected automatically based on the IDE settings
*/
public record Text(@NotNull String text) implements Content {}
/**
* Binary content
*
* @param bytes bytes to write into the new file.
*/
public record Binary(byte @NotNull [] bytes) implements Content {}
}