Share via


Core.Create Method

Definition

Create a new file. This is a synchronous operation.

Not threadsafe when Create is called for same path from different threads with different leaseId.

public static void Create (string path, bool overwrite, string octalPermission, string leaseId, string sessionId, bool createParent, Microsoft.Azure.DataLake.Store.SyncFlag flag, byte[] dataBytes, int offset, int length, Microsoft.Azure.DataLake.Store.AdlsClient client, Microsoft.Azure.DataLake.Store.RequestOptions req, Microsoft.Azure.DataLake.Store.OperationResponse resp);
static member Create : string * bool * string * string * string * bool * Microsoft.Azure.DataLake.Store.SyncFlag * byte[] * int * int * Microsoft.Azure.DataLake.Store.AdlsClient * Microsoft.Azure.DataLake.Store.RequestOptions * Microsoft.Azure.DataLake.Store.OperationResponse -> unit
Public Shared Sub Create (path As String, overwrite As Boolean, octalPermission As String, leaseId As String, sessionId As String, createParent As Boolean, flag As SyncFlag, dataBytes As Byte(), offset As Integer, length As Integer, client As AdlsClient, req As RequestOptions, resp As OperationResponse)

Parameters

path
String

Path of the file

overwrite
Boolean

Overwrites the existing file if the flag is true

octalPermission
String

Octal permission string

leaseId
String

String containing the lease ID, when a client obtains a lease on a file no other client can make edits to the file

sessionId
String

UUID that is used to obtain the file handler (stream) easily at server

createParent
Boolean

If true creates any non-existing parent directories

flag
SyncFlag

Pass SyncFlag.DATA when writing bytes of data Pass SyncFlag.METADATA when metadata of the file like length, modified instant needs to be updated to be consistent with the actual data of file. After passing SyncFlag.METADATA GetFileStatus and ListStatus returns consistent data. Pass SyncFlag.CLOSE when no more data needs to be appended, file metadata is updated, lease is released and the stream is closed

dataBytes
Byte[]

Array of bytes to write to the file

offset
Int32

Offset in the byte array

length
Int32

Number of bytes to write from the offset

client
AdlsClient

ADLS Client

req
RequestOptions

Options to change behavior of the Http request

resp
OperationResponse

Stores the response/ouput of the Http request

Applies to