s3_io Module

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.

Features

  • Familiar Fortran I/O patterns (open/read/write/close)
  • Line-based text file operations
  • Internal buffering for efficient I/O
  • Support for up to 100 concurrent file handles
  • Automatic upload on close for write operations

Usage

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.


Uses


Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: MAX_FILES = 100
type(s3_file), private, save :: files(MAX_FILES)

Derived Types

type, private ::  s3_file

Internal file handle type for managing S3 objects as file-like entities.

Read more…

Components

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.

Subroutines

public subroutine s3_open(unit, key, mode, iostat)

Open an S3 object for reading or writing.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: unit
character(len=*), intent(in) :: key
character(len=*), intent(in) :: mode
integer, intent(out) :: iostat

public subroutine s3_close(unit, iostat)

Close an S3 file handle.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit
integer, intent(out) :: iostat

public subroutine s3_read_line(unit, line, iostat)

Read a line from an open S3 file.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit
character(len=*), intent(out) :: line
integer, intent(out) :: iostat

public subroutine s3_write_line(unit, line, iostat)

Write a line to an open S3 file.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit
character(len=*), intent(in) :: line
integer, intent(out) :: iostat

public subroutine s3_rewind(unit, iostat)

Rewind an S3 file to the beginning.

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit
integer, intent(out) :: iostat