File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,27 @@ class LittleEndianPipe {
115115 pipe = new RandomAccessFile (name , mode );
116116 }
117117
118+ final int readByte () throws IOException {
119+ return pipe .readByte ();
120+ }
121+
122+ final void writeByte (final int b ) throws IOException {
123+ pipe .writeByte (b );
124+ }
125+
118126 final int readInt () throws IOException {
119- return Integer .reverseBytes (pipe .readInt ());
127+ final int b1 = readByte ();
128+ final int b2 = readByte ();
129+ final int b3 = readByte ();
130+ final int b4 = readByte ();
131+ return (b4 << 24 ) | (b3 << 16 ) | (b2 << 8 ) | b1 ;
120132 }
121133
122134 final void writeInt (final int i ) throws IOException {
123- pipe .writeInt (Integer .reverseBytes (i ));
135+ writeByte (i >> 24 );
136+ writeByte ((i >> 16 ) & 0xff );
137+ writeByte ((i >> 8 ) & 0xff );
138+ writeByte (i & 0xff );
124139 }
125140 }
126141
You can’t perform that action at this time.
0 commit comments