/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
/** * Turns the given two strings (with widths) and spacer into a formatted * two-column string. * * @param s1 {@code non-null;} first string * @param width1 {@code > 0;} width of the first column * @param spacer {@code non-null;} spacer string * @param s2 {@code non-null;} second string * @param width2 {@code > 0;} width of the second column * @return {@code non-null;} an appropriately-formatted string */ public static String toString(String s1, int width1, String spacer, String s2, int width2) { int len1 = s1.length(); int len2 = s2.length(); StringWriter sw = new StringWriter((len1 + len2) * 3); TwoColumnOutput twoOut = new TwoColumnOutput(sw, width1, width2, spacer); try { twoOut.getLeft().write(s1); twoOut.getRight().write(s2); } catch (IOException ex) { throw new RuntimeException("shouldn't happen", ex); } twoOut.flush(); return sw.toString(); }
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index
Writer right = twoc.getRight(); int leftAt = 0; // left-hand byte output cursor int rightAt = 0; // right-hand annotation index