High-level Fortran I/O interface for S3 operations.
This module provides a familiar Fortran-style I/O interface for working with S3 objects. It supports operations similar to standard Fortran file I/O: open, read, write, close, and rewind. The module internally buffers content for efficient line-by-line operations.
use s3_http
use s3_io
type(s3_config) :: config
integer :: unit, iostat
character(len=1024) :: line
! Initialize S3
config%bucket = 'my-bucket'
call s3_init(config)
! Open and read
call s3_open(unit, 'data/input.txt', 'read', iostat)
call s3_read_line(unit, line, iostat)
call s3_close(unit, iostat)
Note
This module depends on the s3_http module for underlying S3 operations.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private, | parameter | :: | MAX_FILES | = | 100 | |
type(s3_file), | private, | save | :: | files(MAX_FILES) |
Internal file handle type for managing S3 objects as file-like entities.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | public | :: | is_open | = | .false. | ||
character(len=256), | public | :: | key | = | '' | ||
character(len=:), | public, | allocatable | :: | buffer | |||
integer, | public | :: | position | = | 1 | ||
logical, | public | :: | is_write | = | .false. |
Open an S3 object for reading or writing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out) | :: | unit | |||
character(len=*), | intent(in) | :: | key | |||
character(len=*), | intent(in) | :: | mode | |||
integer, | intent(out) | :: | iostat |
Close an S3 file handle.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit | |||
integer, | intent(out) | :: | iostat |
Read a line from an open S3 file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit | |||
character(len=*), | intent(out) | :: | line | |||
integer, | intent(out) | :: | iostat |
Write a line to an open S3 file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit | |||
character(len=*), | intent(in) | :: | line | |||
integer, | intent(out) | :: | iostat |
Rewind an S3 file to the beginning.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit | |||
integer, | intent(out) | :: | iostat |