gnu.x11
Class Data

java.lang.Object
  extended by gnu.x11.Data
Direct Known Subclasses:
Window.WMHints, Window.WMSizeHints, Window.WMState

public class Data
extends java.lang.Object

Efficient storage of byte array. Similar to "struct" in C/C++. No parsing.


Field Summary
 byte[] data
           
 int index
          Sequential writing.
 int offset
          Lower bound.
 
Constructor Summary
Data()
          Writing.
Data(byte[] data)
          Reading.
Data(byte[][] data)
          Reading.
Data(byte[][][] data)
          Reading.
Data(Data data)
          Reading.
Data(Data data, int offset)
          Offset Reading.
Data(float[] data)
          Reading.
Data(float[][][] data)
          Reading.
Data(int length)
          Writing.
Data(int[][][] data)
          Reading.
Data(int[] data, int unit_size)
          Reading.
 
Method Summary
static java.lang.String byte_to_string(int b)
           
static int len(int n)
          Padded length.
static int len(java.lang.String s)
          Padded length.
 int n()
          Length of byte data.
 int np()
          Padded length of byte data.
 int p()
          Padding length to make a unit of four.
 void pad(int n)
          Writes X bytes of zero, where X is the number that pads n to a multiple of 4.
 boolean read_boolean(int j)
           
 double read_double(int j)
           
 float read_float(int j)
           
 java.lang.String read_string(int j, int length)
           
 int read1(int j)
           
 int read2(int j)
           
 boolean read4_boolean(int j)
           
 int read4(int j)
           
 long read8(int j)
           
static java.lang.String to_string(byte[] buffer, int offset, int length, java.lang.String prefix)
           
 java.lang.String toString()
           
static int unit(byte[] b)
          Padded unit.
static int unit(int n)
          Padded unit.
static int unit(java.lang.String s)
          Padded unit.
 void write_string16(int j, java.lang.String s)
          Writes a field of type STRING16 into the data buffer at the specified position.
 void write_string16(java.lang.String s)
          Writes a field of type STRING16 into the data buffer.
 void write_unused(int i)
           
 void write1_unused()
           
 void write1(boolean b)
           
 void write1(byte[] b)
           
 void write1(byte[] b, int offset)
           
 void write1(byte[] b, int offset, int length)
           
 void write1(Data d)
           
 void write1(int b)
           
 void write1(int j, boolean b)
           
 void write1(int j, byte[] b)
           
 void write1(int j, byte[] b, int offset)
           
 void write1(int j, byte[] b, int offset, int length)
           
 void write1(int j, Data d)
           
 void write1(int j, int b)
           
 void write1(int j, java.lang.String s)
           
 void write1(java.lang.String s)
           
 void write2_unused()
           
 void write2(byte[] b)
           
 void write2(byte[] b, int offset)
           
 void write2(byte[] b, int offset, int length)
           
 void write2(int s)
           
 void write2(int[] b)
           
 void write2(int[] s, int offset)
           
 void write2(int[] s, int offset, int length)
           
 void write2(int j, byte[] b, int offset)
           
 void write2(int j, byte[] b, int offset, int length)
           
 void write2(int j, int s)
           
 void write2(int j, int[] s, int offset)
           
 void write2(int j, int[] s, int offset, int length)
           
 void write2(int j, java.lang.String s)
           
 void write2(java.lang.String s)
           
 void write3_unused()
           
 void write4_unused()
           
 void write4(float f)
           
 void write4(float[] f)
           
 void write4(float[] f, int offset)
           
 void write4(float[] f, int offset, int length)
           
 void write4(int i)
           
 void write4(int[] i)
           
 void write4(int[] i, int offset)
           
 void write4(int[] i, int offset, int length)
           
 void write4(int j, boolean b)
           
 void write4(int j, float f)
           
 void write4(int j, float[] f, int offset)
           
 void write4(int j, float[] f, int offset, int length)
           
 void write4(int j, int i)
           
 void write4(int j, int[] i, int offset)
           
 void write4(int j, int[] i, int offset, int length)
           
 void write8(double d)
           
 void write8(double[] d, int offset)
           
 void write8(double[] d, int offset, int length)
           
 void write8(int j, double d)
           
 void write8(int j, double[] d, int offset)
           
 void write8(int j, double[] d, int offset, int length)
           
 void write8(int j, long l)
           
 void write8(long l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

public int index
Sequential writing.


offset

public int offset
Lower bound.


data

public byte[] data
Constructor Detail

Data

public Data()
Writing.


Data

public Data(int length)
Writing.


Data

public Data(byte[] data)
Reading.


Data

public Data(byte[][] data)
Reading.


Data

public Data(byte[][][] data)
Reading.


Data

public Data(float[] data)
Reading.


Data

public Data(float[][][] data)
Reading.


Data

public Data(int[][][] data)
Reading.


Data

public Data(Data data)
Reading.


Data

public Data(int[] data,
            int unit_size)
Reading.


Data

public Data(Data data,
            int offset)
Offset Reading.

Method Detail

len

public static int len(int n)
Padded length.


len

public static int len(java.lang.String s)
Padded length.


unit

public static int unit(byte[] b)
Padded unit.


unit

public static int unit(int n)
Padded unit.


unit

public static int unit(java.lang.String s)
Padded unit.


read1

public int read1(int j)

read2

public int read2(int j)

read4

public int read4(int j)

read8

public long read8(int j)

read_boolean

public boolean read_boolean(int j)

read4_boolean

public boolean read4_boolean(int j)

read_double

public double read_double(int j)

read_float

public float read_float(int j)

read_string

public java.lang.String read_string(int j,
                                    int length)

write1

public void write1(int j,
                   boolean b)

write1

public void write1(int j,
                   byte[] b)

write1

public void write1(int j,
                   byte[] b,
                   int offset)

write1

public void write1(int j,
                   byte[] b,
                   int offset,
                   int length)

write1

public void write1(int j,
                   int b)

write1

public void write1(int j,
                   Data d)

write1

public void write1(int j,
                   java.lang.String s)

write1

public void write1(boolean b)

write1

public void write1(byte[] b)

write1

public void write1(int b)

write1

public void write1(Data d)

write1

public void write1(java.lang.String s)

write_string16

public void write_string16(java.lang.String s)
Writes a field of type STRING16 into the data buffer.

Parameters:
s - the string to write

write_string16

public void write_string16(int j,
                           java.lang.String s)
Writes a field of type STRING16 into the data buffer at the specified position.

Parameters:
j - the index where to write the string
s - the string to write

write1

public void write1(byte[] b,
                   int offset)

write1

public void write1(byte[] b,
                   int offset,
                   int length)

write2

public void write2(int j,
                   int s)

write2

public void write2(int j,
                   byte[] b,
                   int offset)

write2

public void write2(int j,
                   byte[] b,
                   int offset,
                   int length)

write2

public void write2(int j,
                   int[] s,
                   int offset)

write2

public void write2(int j,
                   int[] s,
                   int offset,
                   int length)

write2

public void write2(int j,
                   java.lang.String s)

write2

public void write2(byte[] b)

write2

public void write2(int[] b)

write2

public void write2(int s)

write2

public void write2(byte[] b,
                   int offset)

write2

public void write2(byte[] b,
                   int offset,
                   int length)

write2

public void write2(int[] s,
                   int offset)

write2

public void write2(int[] s,
                   int offset,
                   int length)

write2

public void write2(java.lang.String s)

write4

public void write4(int j,
                   boolean b)

write4

public void write4(int j,
                   int i)

write4

public void write4(int j,
                   float f)

write4

public void write4(int j,
                   float[] f,
                   int offset)

write4

public void write4(int j,
                   float[] f,
                   int offset,
                   int length)

write4

public void write4(int j,
                   int[] i,
                   int offset)

write4

public void write4(int j,
                   int[] i,
                   int offset,
                   int length)

write4

public void write4(float[] f)

write4

public void write4(int[] i)

write4

public void write4(float f)

write4

public void write4(int i)

write4

public void write4(float[] f,
                   int offset)

write4

public void write4(float[] f,
                   int offset,
                   int length)

write4

public void write4(int[] i,
                   int offset)

write4

public void write4(int[] i,
                   int offset,
                   int length)

write8

public void write8(int j,
                   long l)

write8

public void write8(int j,
                   double d)

write8

public void write8(int j,
                   double[] d,
                   int offset)

write8

public void write8(int j,
                   double[] d,
                   int offset,
                   int length)

write8

public void write8(long l)

write8

public void write8(double d)

write8

public void write8(double[] d,
                   int offset)

write8

public void write8(double[] d,
                   int offset,
                   int length)

pad

public void pad(int n)
Writes X bytes of zero, where X is the number that pads n to a multiple of 4.

Parameters:
n - the number of bytes that have been written and need padding

write_unused

public void write_unused(int i)

write1_unused

public void write1_unused()

write2_unused

public void write2_unused()

write3_unused

public void write3_unused()

write4_unused

public void write4_unused()

to_string

public static java.lang.String to_string(byte[] buffer,
                                         int offset,
                                         int length,
                                         java.lang.String prefix)

byte_to_string

public static java.lang.String byte_to_string(int b)

n

public int n()
Length of byte data.


np

public int np()
Padded length of byte data.


p

public int p()
Padding length to make a unit of four.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object