Class Base64File
File based APIs for Base64- Version:
- 2.3.7
- Author:
- Robert Harder, Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddecodeFileToFile(@NonNull String aInFile, @NonNull File aOutFile) Readsinfileand decodes it tooutfile.static byte @NonNull []decodeFromFile(@NonNull String sFilename) Convenience method for reading a base64-encoded file and decoding it.static @NonNull com.helger.base.state.ESuccessdecodeToFile(@NonNull String sDataToDecode, @NonNull File aFile) Convenience method for decoding data to a file.static voidencodeFileToFile(@NonNull String infile, @NonNull File aFile) Readsinfileand encodes it tooutfile.static @NonNull StringencodeFromFile(@NonNull String sFilename) Convenience method for reading a binary file and base64-encoding it.static @NonNull com.helger.base.state.ESuccessencodeToFile(byte @NonNull [] aDataToEncode, @NonNull File aFile) Convenience method for encoding data to a file.
-
Constructor Details
-
Base64File
public Base64File()
-
-
Method Details
-
encodeToFile
public static @NonNull com.helger.base.state.ESuccess encodeToFile(byte @NonNull [] aDataToEncode, @NonNull File aFile) throws IOException Convenience method for encoding data to a file.As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
- Parameters:
aDataToEncode- byte array of data to encode in base64 formaFile- File for saving encoded data- Returns:
ESuccess- Throws:
IOException- if there is an errorNullPointerException- if dataToEncode is null- Since:
- 2.1
-
decodeToFile
public static @NonNull com.helger.base.state.ESuccess decodeToFile(@NonNull String sDataToDecode, @NonNull File aFile) throws IOException Convenience method for decoding data to a file.As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
- Parameters:
sDataToDecode- Base64-encoded data as a stringaFile- File for saving decoded data- Returns:
ESuccess- Throws:
IOException- if there is an error- Since:
- 2.1
-
decodeFromFile
@ReturnsMutableCopy public static byte @NonNull [] decodeFromFile(@NonNull String sFilename) throws IOException Convenience method for reading a base64-encoded file and decoding it.As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
- Parameters:
sFilename- Filename for reading encoded data- Returns:
- decoded byte array
- Throws:
IOException- if there is an error- Since:
- 2.1
-
encodeFromFile
Convenience method for reading a binary file and base64-encoding it.As of v 2.3, if there is a error, the method will throw an IOException. This is new to v2.3! In earlier versions, it just returned false, but in retrospect that's a pretty poor way to handle it.
- Parameters:
sFilename- Filename for reading binary data- Returns:
- base64-encoded string
- Throws:
IOException- if there is an error- Since:
- 2.1
-
encodeFileToFile
Readsinfileand encodes it tooutfile.- Parameters:
infile- Input fileaFile- Output file- Throws:
IOException- if there is an error- Since:
- 2.2
-
decodeFileToFile
public static void decodeFileToFile(@NonNull String aInFile, @NonNull File aOutFile) throws IOException Readsinfileand decodes it tooutfile.- Parameters:
aInFile- Input fileaOutFile- Output file- Throws:
IOException- if there is an error- Since:
- 2.2
-