Package org.eolang.maven.util
Class HmOptional
- java.lang.Object
-
- org.eolang.maven.util.HmOptional
-
-
Constructor Summary
Constructors Constructor Description HmOptional(Home home, boolean rwte)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Path
absolute(Path path)
Absolute path to a file.boolean
exists(Path path)
Check if exists.org.cactoos.Bytes
load(Path path)
Load bytes from file by path.Path
onlyRelative(Path path)
Verifies that given path is relative and throws exception.void
save(byte[] bytes, Path path)
Saving bytes.void
save(InputStream stream, Path path)
Saving stream.void
save(String str, Path path)
Saving string.void
save(org.cactoos.Input input, Path path)
Saving input.void
save(org.cactoos.Text txt, Path path)
Saving text.
-
-
-
Constructor Detail
-
HmOptional
public HmOptional(Home home, boolean rwte)
Ctor.- Parameters:
home
- Origin homerwte
- Rewrite or not
-
-
Method Detail
-
save
public void save(String str, Path path) throws IOException
Description copied from interface:Home
Saving string.- Specified by:
save
in interfaceHome
- Parameters:
str
- Stringpath
- Cwd-relative path to file- Throws:
IOException
- If fails
-
save
public void save(org.cactoos.Text txt, Path path) throws IOException
Description copied from interface:Home
Saving text.- Specified by:
save
in interfaceHome
- Parameters:
txt
- Textpath
- Cwd-relative path to file- Throws:
IOException
- If fails
-
save
public void save(InputStream stream, Path path) throws IOException
Description copied from interface:Home
Saving stream.- Specified by:
save
in interfaceHome
- Parameters:
stream
- Input streampath
- Cwd-relative path to file- Throws:
IOException
- If fails
-
save
public void save(byte[] bytes, Path path) throws IOException
Description copied from interface:Home
Saving bytes.- Specified by:
save
in interfaceHome
- Parameters:
bytes
- Byte arraypath
- Cwd-relative path to file- Throws:
IOException
- If fails
-
save
public void save(org.cactoos.Input input, Path path) throws IOException
Description copied from interface:Home
Saving input.- Specified by:
save
in interfaceHome
- Parameters:
input
- Inputpath
- Cwd-relative path to file- Throws:
IOException
- If fails
-
load
public org.cactoos.Bytes load(Path path) throws IOException
Description copied from interface:Home
Load bytes from file by path.- Specified by:
load
in interfaceHome
- Parameters:
path
- Cwd-relative path to file- Returns:
- Bytes of file
- Throws:
IOException
- if method can't find the file by path or if some exception happens during reading the file
-
absolute
public Path absolute(Path path)
Description copied from interface:Home
Absolute path to a file.
-
onlyRelative
public Path onlyRelative(Path path)
Description copied from interface:Home
Verifies that given path is relative and throws exception.- Specified by:
onlyRelative
in interfaceHome
- Parameters:
path
- Path to be verified- Returns:
- Given path if it's relative
-
-