Skip to content

Commit 6a31d2a

Browse files
committed
Costmetic fixes.
1 parent 918ac96 commit 6a31d2a

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

src/main/java/org/jsl/collider/DatagramListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public abstract class DatagramListener
3232
public int forwardReadMaxSize;
3333
public int readMinSize;
3434

35-
public DatagramListener( InetSocketAddress addr )
35+
public DatagramListener(InetSocketAddress addr)
3636
{
3737
m_addr = addr;
3838

@@ -48,5 +48,5 @@ public InetSocketAddress getAddr()
4848
return m_addr;
4949
}
5050

51-
public abstract void onDataReceived( RetainableByteBuffer data, SocketAddress sourceAddr );
51+
public abstract void onDataReceived(RetainableByteBuffer data, SocketAddress sourceAddr);
5252
}

src/main/java/org/jsl/collider/DatagramListenerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ public void stopAndWait() throws InterruptedException
481481
m_lock.lock();
482482
try
483483
{
484-
assert( m_run );
484+
assert(m_run);
485485
m_run = false;
486486
m_cond.signalAll();
487487
}
@@ -494,7 +494,7 @@ public void stopAndWait() throws InterruptedException
494494
}
495495
else
496496
{
497-
m_collider.executeInSelectorThread( new Stopper() );
497+
m_collider.executeInSelectorThread(new Stopper());
498498
break;
499499
}
500500
}

src/main/java/org/jsl/collider/RetainableByteBuffer.java

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ public final boolean clearSafe()
148148
* NIO ByteBuffer interface mimic.
149149
*/
150150

151-
ByteOrder order() { return m_buf.order(); }
152-
RetainableByteBuffer order(ByteOrder byteOrder) { m_buf.order(byteOrder); return this; }
151+
public ByteOrder order() { return m_buf.order(); }
152+
public RetainableByteBuffer order(ByteOrder byteOrder) { m_buf.order(byteOrder); return this; }
153153

154154
public abstract int capacity();
155155
public abstract RetainableByteBuffer clear();
@@ -186,29 +186,32 @@ public final RetainableByteBuffer slice()
186186
return new Slice(m_buf.slice(), this);
187187
}
188188

189-
public abstract byte get( int index );
190-
public abstract RetainableByteBuffer put( int index, byte value );
189+
public abstract byte get(int index);
190+
public abstract RetainableByteBuffer put(int index, byte value);
191191

192-
public abstract int getInt( int index );
193-
public abstract RetainableByteBuffer putInt( int index, int value );
192+
public abstract short getShort(int index);
193+
public abstract RetainableByteBuffer putShort(int index, short value);
194194

195-
public abstract short getShort( int index );
196-
public abstract RetainableByteBuffer putShort( int index, short value );
195+
public abstract int getInt(int index);
196+
public abstract RetainableByteBuffer putInt(int index, int value);
197197

198-
public abstract float getFloat( int index );
199-
public abstract RetainableByteBuffer putFloat( int index, float value );
198+
public abstract long getLong(int index);
199+
public abstract RetainableByteBuffer putLong(int index, long value);
200200

201-
public abstract double getDouble( int index );
202-
public abstract RetainableByteBuffer putDouble( int index, double value );
201+
public abstract float getFloat(int index);
202+
public abstract RetainableByteBuffer putFloat(int index, float value);
203+
204+
public abstract double getDouble(int index);
205+
public abstract RetainableByteBuffer putDouble(int index, double value);
203206

204207
public final byte get()
205208
{
206209
return m_buf.get();
207210
}
208211

209-
public final RetainableByteBuffer get( ByteBuffer dst )
212+
public final RetainableByteBuffer get(ByteBuffer dst)
210213
{
211-
dst.put( m_buf );
214+
dst.put(m_buf);
212215
return this;
213216
}
214217

@@ -223,9 +226,9 @@ public final RetainableByteBuffer get( byte [] dst, int offset, int length )
223226
return this;
224227
}
225228

226-
public final RetainableByteBuffer put( byte value )
229+
public final RetainableByteBuffer put(byte value)
227230
{
228-
m_buf.put( value );
231+
m_buf.put(value);
229232
return this;
230233
}
231234

@@ -246,15 +249,26 @@ public final RetainableByteBuffer put( byte [] src )
246249
return put( src, 0, src.length );
247250
}
248251

249-
public final RetainableByteBuffer put( byte [] src, int offset, int length )
252+
public final RetainableByteBuffer put(byte [] src, int offset, int length)
253+
{
254+
m_buf.put(src, offset, length);
255+
return this;
256+
}
257+
258+
public final RetainableByteBuffer putShort(short value)
250259
{
251-
m_buf.put( src, offset, length );
260+
m_buf.putShort(value);
252261
return this;
253262
}
254263

255-
public final RetainableByteBuffer putInt( int value )
264+
public final short getShort()
265+
{
266+
return m_buf.getShort();
267+
}
268+
269+
public final RetainableByteBuffer putInt(int value)
256270
{
257-
m_buf.putInt( value );
271+
m_buf.putInt(value);
258272
return this;
259273
}
260274

@@ -263,15 +277,15 @@ public final int getInt()
263277
return m_buf.getInt();
264278
}
265279

266-
public final RetainableByteBuffer putShort( short value )
280+
public final RetainableByteBuffer putLong(long value)
267281
{
268-
m_buf.putShort( value );
282+
m_buf.putLong(value);
269283
return this;
270284
}
271285

272-
public final short getShort()
286+
public final long getLong()
273287
{
274-
return m_buf.getShort();
288+
return m_buf.getLong();
275289
}
276290

277291
public final RetainableByteBuffer putFloat( float value )
@@ -296,15 +310,15 @@ public final double getDouble()
296310
return m_buf.getDouble();
297311
}
298312

299-
public static RetainableByteBuffer allocate( int capacity )
313+
public static RetainableByteBuffer allocate(int capacity)
300314
{
301-
final ByteBuffer byteBuffer = ByteBuffer.allocate( capacity );
302-
return new Impl( byteBuffer );
315+
final ByteBuffer byteBuffer = ByteBuffer.allocate(capacity);
316+
return new Impl(byteBuffer);
303317
}
304318

305-
public static RetainableByteBuffer allocateDirect( int capacity )
319+
public static RetainableByteBuffer allocateDirect(int capacity)
306320
{
307-
final ByteBuffer byteBuffer = ByteBuffer.allocateDirect( capacity );
308-
return new Impl( byteBuffer );
321+
final ByteBuffer byteBuffer = ByteBuffer.allocateDirect(capacity);
322+
return new Impl(byteBuffer);
309323
}
310324
}

0 commit comments

Comments
 (0)