({{, (RefLink[ByteArrayFormat, paclet:ref/ByteArrayFormat])[ba] 
attempts to determine what (RefLink[ImportByteArray, paclet:ref/ImportByteArray]) format could be used to import the (RefLink[ByteArray, paclet:ref/ByteArray]) object ba.}})

OpenersNotesSection(Spacer1)Details

(RefLink[ByteArrayFormat, paclet:ref/ByteArrayFormat]) returns a format name used by (RefLink[ImportByteArray, paclet:ref/ImportByteArray]).

(RefLink[ByteArrayFormat, paclet:ref/ByteArrayFormat]) uses heuristic methods and may not give correct results, particularly for shorter strings.

(RefLink[ByteArrayFormat, paclet:ref/ByteArrayFormat]) does not verify that (RefLink[ImportByteArray, paclet:ref/ImportByteArray]) would succeed if applied to the (RefLink[ByteArray, paclet:ref/ByteArray]) object ba.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Guess the format of a (RefLink[ByteArray, paclet:ref/ByteArray]):

ByteArrayFormat[ByteArray[]]

Import the (RefLink[ByteArray, paclet:ref/ByteArray]):

ImportByteArray[ByteArray[]]

OpenersExampleSection1(Spacer1)Scope  (1)

Format interpretation of different (RefLink[ByteArray, paclet:ref/ByteArray]) objects:

ByteArrayFormat[ByteArray[]]

ByteArrayFormat[ByteArray[]]

ByteArrayFormat[ByteArray[]]

ByteArrayFormat[ByteArray[]]

OpenersExampleSection3(Spacer1)Applications  (1)

Export an expression to a byte array representing an XLS file:

bytes=ExportByteArray[{{1,2},{3,4},{5,6}},"XLS"]

Check the format of the byte array:

ByteArrayFormat[bytes]

Import the data from the byte array:

ImportByteArray[bytes]

Write the bytes to an XLS file:

BinaryWrite["file.xls",bytes];
Close["file.xls"]

Import the data from the file:

Import["file.xls"]

OpenersExampleSection4(Spacer1)Properties & Relations  (1)

Export to a file and use (RefLink[FileFormat, paclet:ref/FileFormat]) to guess the file format:

Export["file.png",RandomImage[]]

FileFormat[%]

Export to a byte array and guess the format:

ExportByteArray[RandomImage[],"PNG"]

ByteArrayFormat[%]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FileFormat, paclet:ref/FileFormat])  ▪  (RefLink[StringFormat, paclet:ref/StringFormat])  ▪  (RefLink[ImportByteArray, paclet:ref/ImportByteArray])  ▪  (RefLink[ExportByteArray, paclet:ref/ExportByteArray])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Importing and Exporting, paclet:guide/ImportingAndExporting])}})}})