code: public void setLength(long size) throws IOException, RepositoryException
     {
        if (size < 0)
        {
           throw new IOException("Size must be higher or equals 0. But given " + size);
        }
  
        byte[] newBytes = new byte[(int)size];
        System.arraycopy(value, 0, newBytes, 0, Math.min(value.length, newBytes.length));
  
        value = newBytes;
     }
docs: {@inheritDoc}