All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jcraft.jogg.Page Maven / Gradle / Ivy

/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/* JOrbis
 * Copyright (C) 2000 ymnk, JCraft,Inc.
 *  
 * Written by: 2000 ymnk
 *   
 * Many thanks to 
 *   Monty  and 
 *   The XIPHOPHORUS Company http://www.xiph.org/ .
 * JOrbis has been based on their awesome works, Vorbis codec.
 *   
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * as published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
   
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU Library General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package com.jcraft.jogg;

public class Page{
  private static int[] crc_lookup=new int[256];
  static{
    for(int i=0; i>>24)&0xff)^(header_base[header+i]&0xff)];
    }
    for(int i=0; i>>24)&0xff)^(body_base[body+i]&0xff)];
    }
    header_base[header+22]=(byte)crc_reg;
    header_base[header+23]=(byte)(crc_reg>>>8);
    header_base[header+24]=(byte)(crc_reg>>>16);
    header_base[header+25]=(byte)(crc_reg>>>24);
  }

  public Page copy(){
    return copy(new Page());
  }

  public Page copy(Page p){
    byte[] tmp=new byte[header_len];
    System.arraycopy(header_base, header, tmp, 0, header_len);
    p.header_len=header_len;
    p.header_base=tmp;
    p.header=0;
    tmp=new byte[body_len];
    System.arraycopy(body_base, body, tmp, 0, body_len);
    p.body_len=body_len;
    p.body_base=tmp;
    p.body=0;
    return p;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy