### Question:
DicomStreamUtil { public static InputStream dicomStreamWithFileMetaHeader( String sopInstanceUID, String sopClassUID, String transferSyntax, InputStream inDicomStream) throws IOException { ByteArrayOutputStream outBuffer = new ByteArrayOutputStream(); DicomOutputStream fmiStream = new DicomOutputStream(outBuffer, UID.ExplicitVRLittleEndian); Attributes fmi = Attributes.createFileMetaInformation(sopInstanceUID, sopClassUID, transferSyntax); fmiStream.writeFileMetaInformation(fmi); return new SequenceInputStream( new ByteArrayInputStream(outBuffer.toByteArray()), inDicomStream); } private  DicomStreamUtil(); static InputStream dicomStreamWithFileMetaHeader(
      String sopInstanceUID,
      String sopClassUID,
      String transferSyntax,
      InputStream inDicomStream);  }### Answer:
@Test public void testDicomStreamWithFileMetaHeader_correctTransferSyntax() throws Exception { FakePDVInputStream streamNoHeader = new FakePDVInputStream(TestUtils.streamDICOMStripHeaders(TestUtils.TEST_MR_FILE)); String sopClassUID = UID.MRImageStorage; String sopInstanceUID = "1.0.0.0"; String transferSyntax = UID.ExplicitVRLittleEndian; InputStream streamWithHeader = DicomStreamUtil.dicomStreamWithFileMetaHeader( sopInstanceUID, sopClassUID, transferSyntax, streamNoHeader); DicomInputStream dicomInputStream = new DicomInputStream(streamWithHeader); Attributes attrs = dicomInputStream.getFileMetaInformation(); assertThat(attrs.getString(Tag.TransferSyntaxUID)).isEqualTo(transferSyntax); }