Here you can find the source of writeLine(final CharBuffer line, final CharBuffer output)
Parameter | Description |
---|---|
line | Line to consider writing. |
output | Output buffer. |
private static void writeLine(final CharBuffer line, final CharBuffer output)
//package com.java2s; /* See LICENSE for licensing and NOTICE for copyright. */ import java.nio.CharBuffer; public class Main { /** PEM encoding header start string. */ public static final String HEADER_BEGIN = "-----BEGIN"; /** PEM encoding footer start string. */ public static final String FOOTER_END = "-----END"; /** Procedure type tag for PEM-encoded private key in OpenSSL format. */ public static final String PROC_TYPE = "Proc-Type:"; /** Decryption infor tag for PEM-encoded private key in OpenSSL format. */ public static final String DEK_INFO = "DEK-Info:"; /**/*from ww w . j a v a2 s.c o m*/ * Copies a non-header line to the output buffer. * * @param line Line to consider writing. * @param output Output buffer. */ private static void writeLine(final CharBuffer line, final CharBuffer output) { final String s = line.flip().toString(); if (!(s.startsWith(HEADER_BEGIN) || s.startsWith(FOOTER_END) || s.startsWith(PROC_TYPE) || s.startsWith(DEK_INFO) || s.trim().length() == 0)) { output.put(line); } line.clear(); } }