poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject cvs commit: jakarta-poi/src/java/org/apache/poi/util StringUtil.java
Date Mon, 02 May 2005 05:26:13 GMT
avik        2005/05/01 22:26:13

  Modified:    src/java/org/apache/poi/hssf/model Workbook.java
               src/java/org/apache/poi/hssf/record FormatRecord.java
               src/java/org/apache/poi/util StringUtil.java
  Log:
  refactored
  
  Revision  Changes    Path
  1.44      +0 -1      jakarta-poi/src/java/org/apache/poi/hssf/model/Workbook.java
  
  Index: Workbook.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/model/Workbook.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- Workbook.java	1 May 2005 11:26:17 -0000	1.43
  +++ Workbook.java	2 May 2005 05:26:12 -0000	1.44
  @@ -1996,7 +1996,6 @@
           maxformatid = maxformatid >= (short) 0xa4 ? (short) ( maxformatid + 1 ) : (short)
0xa4; //Starting value from M$ empiracle study.
           rec.setIndexCode( maxformatid );
           rec.setFormatStringLength( (byte) format.length() );
  -        rec.setUnicodeFlag(StringUtil.isUnicodeFormat(format));
           rec.setFormatString( format );
   
           int pos = 0;
  
  
  
  1.13      +6 -5      jakarta-poi/src/java/org/apache/poi/hssf/record/FormatRecord.java
  
  Index: FormatRecord.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hssf/record/FormatRecord.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FormatRecord.java	23 Aug 2004 08:52:32 -0000	1.12
  +++ FormatRecord.java	2 May 2005 05:26:13 -0000	1.13
  @@ -36,7 +36,7 @@
   {
       public final static short sid = 0x41e;
       private short             field_1_index_code;
  -    private short             field_2_formatstring_len;
  +
       private short             field_3_unicode_len;      // unicode string length
       private boolean          field_3_unicode_flag;     // it is not undocumented - it is
unicode flag
       private String            field_4_formatstring;
  @@ -85,7 +85,7 @@
           field_1_index_code       = LittleEndian.getShort(data, 0 + offset);
           // field_2_formatstring_len = data[ 2 + offset ];
           field_3_unicode_len      = LittleEndian.getShort( data, 2 + offset );
  -	field_2_formatstring_len = field_3_unicode_len;
  +
           field_3_unicode_flag     = ( data[ 4 + offset ] & (byte)0x01 ) != 0;
                                                 
                                                 
  @@ -120,7 +120,7 @@
       
       public void setFormatStringLength(byte len)
       {
  -        field_2_formatstring_len = len;
  +
   	field_3_unicode_len = len;
       }
   
  @@ -144,6 +144,7 @@
       public void setFormatString(String fs)
       {
           field_4_formatstring = fs;
  +        setUnicodeFlag(StringUtil.isUnicodeString(fs));
       }
   
       /**
  @@ -165,10 +166,10 @@
        * @see #getFormatString()
        */
   
  -    public short getFormatStringLength()
  +   /* public short getFormatStringLength()
       {
           return field_3_unicode_flag ? field_3_unicode_len : field_2_formatstring_len;
  -    }
  +    }*/
   
       /**
        * get whether the string is unicode
  
  
  
  1.19      +3 -3      jakarta-poi/src/java/org/apache/poi/util/StringUtil.java
  
  Index: StringUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/util/StringUtil.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- StringUtil.java	28 Apr 2005 14:03:28 -0000	1.18
  +++ StringUtil.java	2 May 2005 05:26:13 -0000	1.19
  @@ -322,11 +322,11 @@
   	
   	/**
   	   * @param format
  -	   * @return true if format is Unicode.
  +	   * @return true if string needs Unicode to be represented.
   	   */
  -	  public static boolean isUnicodeFormat(final String format) {
  +	  public static boolean isUnicodeString(final String value) {
   	    try {
  -	      return !format.equals(new String(format.getBytes("ISO-8859-1"), "ISO-8859-1"));
  +	      return !value.equals(new String(value.getBytes("ISO-8859-1"), "ISO-8859-1"));
   	    } catch (UnsupportedEncodingException e) {
   	      return true;
   	    }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message