[ 
https://issues.apache.org/jira/browse/COMPRESS-407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319753#comment-16319753
 ] 

Christopher Hunt edited comment on COMPRESS-407 at 1/10/18 6:36 AM:
--------------------------------------------------------------------

I've just had another look at this - an important difference that I notice is 
the size of the byte array produced by the following code:

{code:java}
      val tar = {
        val bos = new ByteArrayOutputStream()
        val tos =
          new ArchiveStreamFactory()
            .createArchiveOutputStream(ArchiveStreamFactory.TAR, bos)
            .asInstanceOf[TarArchiveOutputStream]
        try {
          tos.flush()
          tos.finish()
        } finally {
          tos.close()
        }
        bos.toByteArray
      }
{code}

The size of the "tar" variable is 10240 on 1.14. However, it is just 1024 on 
1.15.

My understanding was that tape archives are generally padded out to 10240 by 
default e.g. given:

{code}
     val Blocksize = 512
     val BlockingFactor = 20
     val RecordSize = Blocksize * BlockingFactor
{code}

It appears as though the behaviour has therefore changed for 1.15. Thoughts?


was (Author: hu...@internode.on.net):
I've just had another look at this - an important difference that I notice is 
the size of the byte array produced by the following code:

{code:java}
      val tar = {
        val bos = new ByteArrayOutputStream()
        val tos =
          new ArchiveStreamFactory()
            .createArchiveOutputStream(ArchiveStreamFactory.TAR, bos)
            .asInstanceOf[TarArchiveOutputStream]
        try {
          tos.flush()
          tos.finish()
        } finally {
          tos.close()
        }
        bos.toByteArray
      }
{code}

The size of the "tar" variable is 10240 on 1.14. However, it is just 1024 on 
1.15.

My understanding was that tape archives are always padded out to 10240 by 
default e.g. given:

{code}
     val Blocksize = 512
     val BlockingFactor = 20
     val RecordSize = Blocksize * BlockingFactor
{code}

It appears as though the behaviour has therefore changed for 1.15. Thoughts?

> Validate Block and Record Sizes
> -------------------------------
>
>                 Key: COMPRESS-407
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-407
>             Project: Commons Compress
>          Issue Type: Sub-task
>          Components: Archivers
>            Reporter: Simon Spero
>             Fix For: 1.15
>
>
> Reject record sizes not equal to 512 bytes; require block sizes to be 
> multiples of 512 bytes.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to