Class ArchPaths
- java.lang.Object
-
- org.epics.archiverappliance.utils.nio.ArchPaths
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ArchPaths extends Object implements Closeable
This is a replacement for NIO Paths that caters to our syntax rules. Normal file system paths are all similar to linux file names. The compressed use the jar:file:syntax. For example,jar:file:///ziptest/alltext.zip!/SomeTextFile.txt
- Author:
- luofeng, mshankar
-
-
Field Summary
Fields Modifier and Type Field Description static String
ZIP_PREFIX
-
Constructor Summary
Constructors Constructor Description ArchPaths()
-
Method Summary
Modifier and Type Method Description void
close()
Path
get(boolean createParent, String first, String... more)
Return a path based on a varargs list of path components.Path
get(String uriPathOrDefautFilePath)
Path
get(String uriPathOrDefautFilePath, boolean createParent)
Return a path based on the full URI representation of the path.Path
get(String first, String... more)
Return a path based on a varargs list of path components.String
getPathForBackup(Path path)
The path used for backing up the data using ETL.static SeekableByteChannel
newByteChannel(Path path, OpenOption... options)
Returns a seekable byte channel.
-
-
-
Field Detail
-
ZIP_PREFIX
public static final String ZIP_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public Path get(String first, String... more) throws IOException
Return a path based on a varargs list of path components. Each path component is separated by the file separator.- Parameters:
first
-more
-- Returns:
- Path
- Throws:
IOException
-
-
get
public Path get(boolean createParent, String first, String... more) throws IOException
Return a path based on a varargs list of path components. Each path component is separated by the file separator.- Parameters:
createParent
- If this is true, we create the parent automatically when requesting the pathfirst
-more
-- Returns:
- Path
- Throws:
IOException
-
-
get
public Path get(String uriPathOrDefautFilePath) throws IOException
- Parameters:
uriPathOrDefautFilePath
-- Returns:
- Path
- Throws:
IOException
-
-
get
public Path get(String uriPathOrDefautFilePath, boolean createParent) throws IOException
Return a path based on the full URI representation of the path.- Parameters:
uriPathOrDefautFilePath
-createParent
- If this is true, we create the parent automatically when requesting the path- Returns:
- Path
- Throws:
IOException
-
-
newByteChannel
public static SeekableByteChannel newByteChannel(Path path, OpenOption... options) throws IOException
Returns a seekable byte channel. In case of file systems, this is the raw SeekableByteChannel as returned by the provider. In case of zip files, we wrap the InputStream using WrappedSeekableByteChannel (which is a read only byte channel for now).- Parameters:
path
- Pathoptions
- OpenOption- Returns:
- a new seekabel byte channel
- Throws:
IOException
-
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getPathForBackup
public String getPathForBackup(Path path) throws IOException
The path used for backing up the data using ETL. When enabling compression with packing, we backup the packed file itself as opposed to the files within the packed file.- Parameters:
path
- Path- Returns:
- Path for backup
- Throws:
IOException
-
-
-