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 Pathabsolute(Path path)Absolute path to a file.booleanexists(Path path)Check if exists.org.cactoos.Bytesload(Path path)Load bytes from file by path.PathonlyRelative(Path path)Verifies that given path is relative and throws exception.voidsave(byte[] bytes, Path path)Saving bytes.voidsave(InputStream stream, Path path)Saving stream.voidsave(String str, Path path)Saving string.voidsave(org.cactoos.Input input, Path path)Saving input.voidsave(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:HomeSaving string.- Specified by:
savein interfaceHome- Parameters:
str- Stringpath- Cwd-relative path to file- Throws:
IOException- If fails
-
save
public void save(org.cactoos.Text txt, Path path) throws IOExceptionDescription copied from interface:HomeSaving text.- Specified by:
savein 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:HomeSaving stream.- Specified by:
savein interfaceHome- Parameters:
stream- Input streampath- Cwd-relative path to file- Throws:
IOException- If fails
-
save
public void save(byte[] bytes, Path path) throws IOExceptionDescription copied from interface:HomeSaving bytes.- Specified by:
savein 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 IOExceptionDescription copied from interface:HomeSaving input.- Specified by:
savein 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:HomeLoad bytes from file by path.- Specified by:
loadin 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:HomeAbsolute path to a file.
-
onlyRelative
public Path onlyRelative(Path path)
Description copied from interface:HomeVerifies that given path is relative and throws exception.- Specified by:
onlyRelativein interfaceHome- Parameters:
path- Path to be verified- Returns:
- Given path if it's relative
-
-