public class CoreIOUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CoreIOUtils.AbstractItem |
static class |
CoreIOUtils.AbstractMultiReadItem |
static class |
CoreIOUtils.CachedURL |
static class |
CoreIOUtils.DefaultMultiReadItem |
static class |
CoreIOUtils.InputStream |
static class |
CoreIOUtils.MonitorType |
static class |
CoreIOUtils.URLInput |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
static DirectoryStream.Filter<Path> |
DIR_FILTER |
static String |
newLineString |
| Constructor and Description |
|---|
CoreIOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
Arrays_equals(byte[] a,
int aFromIndex,
int aToIndex,
byte[] b,
int bFromIndex,
int bToIndex) |
static URL |
asURL(String s) |
static String |
buildUrl(String url,
String path) |
static char[] |
bytesToChars(byte[] bytes) |
static String |
bytesToHex(byte[] bytes) |
static byte[] |
charsToBytes(char[] chars) |
static boolean |
compareContent(Path file1,
Path file2) |
static OutputStream |
convertOutputStream(OutputStream out,
net.thevpc.nuts.NutsTerminalMode expected,
net.thevpc.nuts.NutsSession session) |
static ExtendedFormatAware |
convertOutputStreamToExtendedFormatAware(OutputStream out,
net.thevpc.nuts.NutsTerminalMode expected,
net.thevpc.nuts.NutsSession session) |
static long |
copy(InputStream in,
OutputStream out)
copy input to output
|
static long |
copy(InputStream from,
OutputStream to,
boolean closeInput,
boolean closeOutput) |
static long |
copy(InputStream in,
OutputStream out,
int bufferSize)
copy input stream to output stream using the buffer size in bytes
|
static void |
copy(Reader in,
Writer out)
copy input to output
|
static void |
copy(Reader in,
Writer out,
int bufferSize)
copy input stream to output stream using the buffer size in bytes
|
static void |
copyFolder(Path src,
Path dest) |
static CoreInput |
createInputSource(byte[] source,
String name,
net.thevpc.nuts.NutsString formattedString,
String typeName,
net.thevpc.nuts.NutsSession session) |
static net.thevpc.nuts.NutsProgressFactory |
createLogProgressMonitorFactory(CoreIOUtils.MonitorType mt) |
static net.thevpc.nuts.NutsProgressMonitor |
createProgressMonitor(CoreIOUtils.MonitorType mt,
Object source,
Object sourceOrigin,
net.thevpc.nuts.NutsSession session,
boolean logProgress,
net.thevpc.nuts.NutsProgressFactory progressFactory) |
static void |
delete(net.thevpc.nuts.NutsSession session,
File file) |
static void |
delete(net.thevpc.nuts.NutsSession session,
Path file) |
static String |
escapePropsString(String theString,
boolean escapeSpace) |
static byte[] |
evalHash(InputStream input,
String algo) |
static byte[] |
evalMD5(byte[] bytesOfMessage) |
static byte[] |
evalMD5(InputStream input) |
static byte[] |
evalMD5(Path path) |
static byte[] |
evalMD5(String input) |
static String |
evalMD5Hex(InputStream input) |
static String |
evalMD5Hex(Path path) |
static char[] |
evalSHA1(char[] input) |
static String |
evalSHA1(File file) |
static byte[] |
evalSHA1(InputStream input,
boolean closeStream) |
static String |
evalSHA1(String input) |
static String |
evalSHA1Hex(InputStream input,
boolean closeStream) |
static String |
evalSHA1Hex(Path file) |
static char[] |
evalSHA1HexChars(InputStream input,
boolean closeStream) |
static String |
getAbsolutePath(String path) |
static net.thevpc.nuts.NutsInput |
getCachedUrlWithSHA1(net.thevpc.nuts.NutsWorkspace ws,
String path,
String sourceTypeName,
boolean ignoreSha1NotFound,
net.thevpc.nuts.NutsSession session) |
static String |
getFileExtension(String s) |
static String |
getFileExtension(String s,
boolean longest,
boolean includeDot) |
static net.thevpc.nuts.spi.NutsTransportConnection |
getHttpClientFacade(net.thevpc.nuts.NutsSession session,
String url) |
static String |
getNativePath(String path) |
static String |
getNewLine() |
static String |
getPath(net.thevpc.nuts.NutsId id,
String ext,
char sep) |
static String |
getURLName(String path) |
static String |
getURLName(URL url) |
static String |
getURLParent(String url) |
static List<String> |
headFrom(net.thevpc.nuts.NutsInput input,
int count) |
static InputStream |
interruptible(InputStream in) |
static boolean |
isAbsolutePath(String location) |
static boolean |
isObsoleteInstant(net.thevpc.nuts.NutsSession session,
Instant instant) |
static boolean |
isObsoletePath(net.thevpc.nuts.NutsSession session,
Path path) |
static boolean |
isPathFile(String s) |
static boolean |
isPathHttp(String s) |
static boolean |
isPathLocal(String s) |
static boolean |
isPathURL(String s) |
static boolean |
isURL(String url) |
static boolean |
isValidInputStreamSource(Class type) |
static Stream<String> |
linesFrom(net.thevpc.nuts.NutsInput input) |
static byte[] |
loadByteArray(InputStream r) |
static byte[] |
loadByteArray(InputStream r,
boolean close) |
static byte[] |
loadByteArray(InputStream stream,
int maxSize,
boolean close) |
static char[] |
loadCharArray(Reader r) |
static String |
loadString(InputStream is,
boolean close) |
static String |
loadString(Reader is,
boolean close) |
static boolean |
mkdirs(Path p) |
static InputStream |
monitor(InputStream from,
Object source,
net.thevpc.nuts.NutsProgressMonitor monitor,
net.thevpc.nuts.NutsSession session) |
static InputStream |
monitor(InputStream from,
Object source,
net.thevpc.nuts.NutsString sourceName,
long length,
net.thevpc.nuts.NutsProgressMonitor monitor,
net.thevpc.nuts.NutsSession session) |
static InputStream |
monitor(URL from,
net.thevpc.nuts.NutsProgressMonitor monitor,
net.thevpc.nuts.NutsSession session) |
static int |
readFully(byte[] b,
int off,
int len,
InputStream in) |
static File |
resolveLocalFileFromResource(Class cls,
String url,
net.thevpc.nuts.NutsSession session) |
static File |
resolveLocalFileFromURL(URL url) |
static Path |
resolveLocalPathFromURL(URL url) |
static net.thevpc.nuts.NutsDescriptor |
resolveNutsDescriptorFromFileContent(net.thevpc.nuts.NutsInput localPath,
String[] parseOptions,
net.thevpc.nuts.NutsSession session) |
static NutsTerminalModeOp |
resolveNutsTerminalModeOp(OutputStream out) |
static net.thevpc.nuts.NutsPrintStream |
resolveOut(net.thevpc.nuts.NutsSession session) |
static String |
resolveRepositoryPath(net.thevpc.nuts.NutsAddRepositoryOptions options,
Path rootFolder,
net.thevpc.nuts.NutsSession session) |
static URL |
resolveURLFromResource(Class cls,
String urlPath,
net.thevpc.nuts.NutsSession session) |
static boolean |
setExecutable(Path path) |
static void |
storeProperties(Map<String,String> props,
OutputStream out,
boolean sort) |
static void |
storeProperties(Map<String,String> props,
Writer w,
boolean sort) |
static String |
syspath(String s) |
static Path |
sysWhich(String commandName) |
static Path[] |
sysWhichAll(String commandName) |
static List<String> |
tailFrom(net.thevpc.nuts.NutsInput input,
int max) |
static File |
toFile(String url) |
static File |
toFile(URL url) |
static char |
toHex(int nibble) |
static char[] |
toHexChars(byte[] bytes) |
static String |
toHexString(byte[] bytes) |
static Path |
toPath(Object lockedObject) |
static Path |
toPath(String path) |
static Path |
toPathFile(String s,
net.thevpc.nuts.NutsSession session) |
static net.thevpc.nuts.NutsInput |
toPathInputSource(net.thevpc.nuts.NutsInput is,
List<Path> tempPaths,
net.thevpc.nuts.NutsSession session) |
static PrintWriter |
toPrintWriter(OutputStream writer,
net.thevpc.nuts.NutsSession session) |
static PrintWriter |
toPrintWriter(Writer writer,
net.thevpc.nuts.NutsSession session) |
static URL[] |
toURL(File[] all) |
static URL[] |
toURL(String[] all) |
static String |
trimSlashes(String repositoryIdPath) |
static String |
urlEncodeString(String s) |
static String |
urlTrimFirstSlash(String url) |
static String |
urlTrimLastSlash(String url) |
public static final int DEFAULT_BUFFER_SIZE
public static final DirectoryStream.Filter<Path> DIR_FILTER
public static String newLineString
public static PrintWriter toPrintWriter(Writer writer, net.thevpc.nuts.NutsSession session)
public static PrintWriter toPrintWriter(OutputStream writer, net.thevpc.nuts.NutsSession session)
public static OutputStream convertOutputStream(OutputStream out, net.thevpc.nuts.NutsTerminalMode expected, net.thevpc.nuts.NutsSession session)
public static ExtendedFormatAware convertOutputStreamToExtendedFormatAware(OutputStream out, net.thevpc.nuts.NutsTerminalMode expected, net.thevpc.nuts.NutsSession session)
public static boolean setExecutable(Path path)
public static boolean mkdirs(Path p)
public static boolean isPathFile(String s)
public static boolean isPathLocal(String s)
public static boolean isPathHttp(String s)
public static boolean isPathURL(String s)
public static String resolveRepositoryPath(net.thevpc.nuts.NutsAddRepositoryOptions options, Path rootFolder, net.thevpc.nuts.NutsSession session)
public static net.thevpc.nuts.NutsPrintStream resolveOut(net.thevpc.nuts.NutsSession session)
public static net.thevpc.nuts.NutsDescriptor resolveNutsDescriptorFromFileContent(net.thevpc.nuts.NutsInput localPath,
String[] parseOptions,
net.thevpc.nuts.NutsSession session)
localPath - localPathparseOptions - may include --all-mains to force lookup of all main
classes if availablesession - sessionpublic static void copy(Reader in, Writer out)
in - entreeout - sortiepublic static long copy(InputStream in, OutputStream out)
in - entreeout - sortiepublic static long copy(InputStream in, OutputStream out, int bufferSize)
in - entreeout - sortiebufferSize - bufferSizepublic static void copy(Reader in, Writer out, int bufferSize)
in - entreeout - sortiebufferSize - bufferSizepublic static String loadString(InputStream is, boolean close)
public static char[] loadCharArray(Reader r)
public static byte[] loadByteArray(InputStream r)
public static byte[] loadByteArray(InputStream r, boolean close)
public static byte[] loadByteArray(InputStream stream, int maxSize, boolean close)
public static long copy(InputStream from, OutputStream to, boolean closeInput, boolean closeOutput)
public static InputStream monitor(URL from, net.thevpc.nuts.NutsProgressMonitor monitor, net.thevpc.nuts.NutsSession session)
public static InputStream monitor(InputStream from, Object source, net.thevpc.nuts.NutsString sourceName, long length, net.thevpc.nuts.NutsProgressMonitor monitor, net.thevpc.nuts.NutsSession session)
public static InputStream monitor(InputStream from, Object source, net.thevpc.nuts.NutsProgressMonitor monitor, net.thevpc.nuts.NutsSession session)
public static void delete(net.thevpc.nuts.NutsSession session,
File file)
public static void delete(net.thevpc.nuts.NutsSession session,
Path file)
public static String getFileExtension(String s, boolean longest, boolean includeDot)
public static boolean isURL(String url)
public static CoreInput createInputSource(byte[] source, String name, net.thevpc.nuts.NutsString formattedString, String typeName, net.thevpc.nuts.NutsSession session)
public static boolean isValidInputStreamSource(Class type)
public static net.thevpc.nuts.spi.NutsTransportConnection getHttpClientFacade(net.thevpc.nuts.NutsSession session,
String url)
public static URL resolveURLFromResource(Class cls, String urlPath, net.thevpc.nuts.NutsSession session)
public static File resolveLocalFileFromResource(Class cls, String url, net.thevpc.nuts.NutsSession session)
public static String bytesToHex(byte[] bytes)
public static String toHexString(byte[] bytes)
public static char[] toHexChars(byte[] bytes)
public static char toHex(int nibble)
public static byte[] evalMD5(String input)
public static byte[] evalMD5(Path path)
public static String evalMD5Hex(InputStream input)
public static byte[] evalHash(InputStream input, String algo)
public static byte[] evalMD5(InputStream input)
public static byte[] evalMD5(byte[] bytesOfMessage)
public static byte[] charsToBytes(char[] chars)
public static char[] bytesToChars(byte[] bytes)
public static char[] evalSHA1(char[] input)
public static String evalSHA1Hex(InputStream input, boolean closeStream)
public static char[] evalSHA1HexChars(InputStream input, boolean closeStream)
public static byte[] evalSHA1(InputStream input, boolean closeStream)
public static net.thevpc.nuts.NutsInput getCachedUrlWithSHA1(net.thevpc.nuts.NutsWorkspace ws,
String path,
String sourceTypeName,
boolean ignoreSha1NotFound,
net.thevpc.nuts.NutsSession session)
public static void storeProperties(Map<String,String> props, OutputStream out, boolean sort)
public static void storeProperties(Map<String,String> props, Writer w, boolean sort)
public static net.thevpc.nuts.NutsInput toPathInputSource(net.thevpc.nuts.NutsInput is,
List<Path> tempPaths,
net.thevpc.nuts.NutsSession session)
public static String getNewLine()
public static boolean isAbsolutePath(String location)
public static net.thevpc.nuts.NutsProgressFactory createLogProgressMonitorFactory(CoreIOUtils.MonitorType mt)
public static net.thevpc.nuts.NutsProgressMonitor createProgressMonitor(CoreIOUtils.MonitorType mt, Object source, Object sourceOrigin, net.thevpc.nuts.NutsSession session, boolean logProgress, net.thevpc.nuts.NutsProgressFactory progressFactory)
public static InputStream interruptible(InputStream in)
public static NutsTerminalModeOp resolveNutsTerminalModeOp(OutputStream out)
public static boolean isObsoletePath(net.thevpc.nuts.NutsSession session,
Path path)
public static boolean isObsoleteInstant(net.thevpc.nuts.NutsSession session,
Instant instant)
public static final int readFully(byte[] b,
int off,
int len,
InputStream in)
public static boolean Arrays_equals(byte[] a,
int aFromIndex,
int aToIndex,
byte[] b,
int bFromIndex,
int bToIndex)
Copyright © 2021 vpc open source initiative. All rights reserved.