@Test public void testVisitContentIdHeader() { TestFileLikePart fileLikePart = new TestFileLikePart(null, null, null, "contentId"); try (TestMultipartPart multipartPart = new TestMultipartPart(fileLikePart, new byte[0])) { CounterPartVisitor counterVisitor = new CounterPartVisitor(); multipartPart.visitContentIdHeader(counterVisitor); assertEquals(counterVisitor.getCount(), 23, "CounterPartVisitor count for visitContentIdHeader should be equal to" + "CRLF_BYTES length + CONTENT_ID_BYTES length + contentId length"); } }
protected void visitContentIdHeader(PartVisitor visitor) { String contentId = part.getContentId(); if (contentId != null) { visitor.withBytes(CRLF_BYTES); visitor.withBytes(CONTENT_ID_BYTES); visitor.withBytes(contentId.getBytes(US_ASCII)); } }
MultipartPart implements Closeable { protected void visitContentIdHeader(PartVisitor visitor) { String contentId = part.getContentId(); if (contentId != null) { visitor.withBytes(CRLF_BYTES); visitor.withBytes(CONTENT_ID_BYTES); visitor.withBytes(contentId.getBytes(US_ASCII)); } } }
MultipartPart implements Closeable { protected void visitContentIdHeader(PartVisitor visitor) { String contentId = part.getContentId(); if (contentId != null) { visitor.withBytes(CRLF_BYTES); visitor.withBytes(CONTENT_ID_BYTES); visitor.withBytes(contentId.getBytes(US_ASCII)); } } MultipartPart(T part, byte[] boundary); }
MultipartPart implements Closeable { protected void visitContentIdHeader(PartVisitor visitor) { String contentId = part.getContentId(); if (contentId != null) { visitor.withBytes(CRLF_BYTES); visitor.withBytes(CONTENT_ID_BYTES); visitor.withBytes(contentId.getBytes(US_ASCII)); } } MultipartPart(T part, byte[] boundary); long length(); MultipartState getState(); boolean isTargetSlow(); long transferTo(ByteBuf target); long transferTo(WritableByteChannel target); @Override void close(); }
MultipartPart implements Closeable { protected void visitContentIdHeader(PartVisitor visitor) { String contentId = part.getContentId(); if (contentId != null) { visitor.withBytes(CRLF_BYTES); visitor.withBytes(CONTENT_ID_BYTES); visitor.withBytes(contentId.getBytes(US_ASCII)); } } MultipartPart(T part, byte[] boundary); long length(); MultipartState getState(); boolean isTargetSlow(); long transferTo(ByteBuf target); long transferTo(WritableByteChannel target); @Override void close();  }