1/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. 2 * 3 * This program and the accompanying materials are made available under 4 * the terms of the Common Public License v1.0 which accompanies this distribution, 5 * and is available at http://www.eclipse.org/legal/cpl-v10.html 6 * 7 * $Id: CONSTANT_Long_info.java,v 1.1.1.1 2004/05/09 16:57:49 vlad_r Exp $ 8 */ 9package com.vladium.jcd.cls.constant; 10 11import java.io.IOException; 12 13import com.vladium.jcd.lib.UDataInputStream; 14import com.vladium.jcd.lib.UDataOutputStream; 15 16// ---------------------------------------------------------------------------- 17/** 18 * The CONSTANT_Long_info and {@link CONSTANT_Double_info} represent eight-byte 19 * numeric (long and double) constants.<P> 20 * 21 * The unsigned high_bytes and low_bytes items of the CONSTANT_Long_info structure 22 * together contain the value of the long constant 23 * (( long ) high_bytes << 32) + low_bytes , where the bytes of each of high_bytes 24 * and low_bytes are stored in big-endian (high byte first) order. 25 * 26 * @author (C) 2001, Vlad Roubtsov 27 */ 28public 29final class CONSTANT_Long_info extends CONSTANT_literal_info 30{ 31 // public: ................................................................ 32 33 public static final byte TAG = 5; 34 35 public long m_value; 36 37 38 public CONSTANT_Long_info (final long value) 39 { 40 m_value = value; 41 } 42 43 public final byte tag () 44 { 45 return TAG; 46 } 47 48 // Visitor: 49 50 public Object accept (final ICONSTANTVisitor visitor, final Object ctx) 51 { 52 return visitor.visit (this, ctx); 53 } 54 55 public String toString () 56 { 57 return Long.toString (m_value); 58 } 59 60 /** 61 * Overrides the default implementation to return '2'. 62 */ 63 public int width () 64 { 65 return 2; 66 } 67 68 // Cloneable: inherited clone() is Ok 69 70 // IClassFormatOutput: 71 72 public void writeInClassFormat (final UDataOutputStream out) throws IOException 73 { 74 super.writeInClassFormat (out); 75 76 out.writeLong (m_value); 77 } 78 79 // protected: ............................................................. 80 81 82 protected CONSTANT_Long_info (final UDataInputStream bytes) throws IOException 83 { 84 m_value = bytes.readLong (); 85 } 86 87 // package: ............................................................... 88 89 // private: ............................................................... 90 91} // end of class 92// ---------------------------------------------------------------------------- 93