⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 put.java

📁 Gif89Encoder! JAVA环境下应用!
💻 JAVA
字号:
//******************************************************************************
// Put.java
//******************************************************************************
package net.jmge.gif;

import java.io.OutputStream;
import java.io.IOException;

//==============================================================================
/** Just a couple of trivial output routines used by other classes in the
 *  package.  Normally this kind of stuff would be in a separate IO package, but
 *  I wanted the present package to be self-contained for ease of distribution
 *  and use by others.
 */
final class Put {

  //----------------------------------------------------------------------------
  /** Write just the low bytes of a String.  (This sucks, but the concept of an
   *  encoding seems inapplicable to a binary file ID string.  I would think
   *  flexibility is just what we don't want - but then again, maybe I'm slow.)
   */  
  static void ascii(String s, OutputStream os) throws IOException
  {
    byte[] bytes = new byte[s.length()];
    for (int i = 0; i < bytes.length; ++i)
      bytes[i] = (byte) s.charAt(i);  // discard the high byte     
    os.write(bytes); 
  }

  //----------------------------------------------------------------------------
  /** Write a 16-bit integer in little endian byte order.
   */   
  static void leShort(int i16, OutputStream os) throws IOException
  {
    os.write(i16 & 0xff);
    os.write(i16 >> 8 & 0xff);
  } 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -