Package io.milton.zsync
Class Util
java.lang.Object
io.milton.zsync.Util
A number of useful, static methods.
- Version:
- $Revision: 1.7 $
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringbase64(byte[] buf) Base-64 encode a byte array, returning the returning string.static voidclose(RandomAccessFile randAccess) static voidclose(FileChannel rc) static StringreadLine(InputStream in) Read up to a '\n' or '\r', and return the resulting string.static StringtoHexString(byte[] b) Convert a byte array to a big-endian ordered hexadecimal string.static StringtoHexString(byte[] b, int off, int len) Convert a byte array to a big-endian ordered hexadecimal string.static voidwriteASCII(OutputStream out, String ascii) Write a String as a sequece of ASCII bytes.
-
Field Details
-
BASE_64
The characters for Base64 encoding.- See Also:
-
-
Method Details
-
base64
Base-64 encode a byte array, returning the returning string.Note that this method exists merely to be compatible with the challenge-response authentication method of rsyncd. It is not technincally a Base-64 encoder.
- Parameters:
buf- The byte array to encode.- Returns:
- buf encoded in Base64.
-
writeASCII
Write a String as a sequece of ASCII bytes.- Parameters:
out- TheOutputStreamto write to.ascii- The ASCII string to write.- Throws:
IOException- If writing fails.
-
readLine
Read up to a '\n' or '\r', and return the resulting string. The input is assumed to be ISO-8859-1.- Parameters:
in- TheInputStreamto read from.- Returns:
- The line read, without the line terminator.
- Throws:
IOException
-
toHexString
Convert a byte array to a big-endian ordered hexadecimal string.- Parameters:
b- The bytes to convert.- Returns:
- A hexadecimal representation to b.
-
toHexString
Convert a byte array to a big-endian ordered hexadecimal string.- Parameters:
b- The bytes to convert.- Returns:
- A hexadecimal representation to b.
-
close
-
close
-