On Thu, 1 May 2025 00:25:38 GMT, Anthony Scarpino <ascarp...@openjdk.org> wrote:
>> Yes, this method is private. But you allow >> `PEMEncoder().of().encode(PEMRecord)`. People might wonder why their leading >> data is lost. > > Then they can call PEMRecord.leadingData(). They can. Just tell them. >> I meant the newline char at the end (before the "------BEGIN" chars). I just >> tried out your implementation, and noticed if there is nothing there, then >> `leadingData` is null; and if there is a line of text, `leadingData` >> contains the newline char at the end. >> >> I still think this is worth mentioning. Suppose someone wants to rewrite the >> PEM file with the leading data, they need to know they should not use >> `println`. >> >> BTW, I prefer trimming that newline char. Just my opinion. > > I see your point now, but `leadingData` is a byte array. If an app wrote the > `leadingData` in a `ByteArrayInputStream`, followed by the PEM text, it would > not be the same data written as the newline would be gone. Correct? Why would it be gone? It's a 0x10 at the end of the byte array. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2070577038 PR Review Comment: https://git.openjdk.org/jdk/pull/17543#discussion_r2070576217