Example #1
0
 @Override
 public short getUnsignedByte(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readUnsignedByte();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #2
0
 @Override
 public int getBytes(int index, GatheringByteChannel out, int length) throws IOException {
   int pos = delegate.positionReader(index);
   try {
     return readBytes(out, length);
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #3
0
 @Override
 public void setLong(int index, long value) {
   int pos = delegate.positionWriter(index);
   try {
     writeLong(value);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #4
0
 @Override
 public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException {
   int pos = delegate.positionWriter(index);
   try {
     return writeBytes(in, length);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #5
0
 @Override
 public void getBytes(int index, OutputStream out, int length) throws IOException {
   int pos = delegate.positionReader(index);
   try {
     readBytes(out, length);
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #6
0
 @Override
 public void setBytes(int index, ChannelBuffer src, int length) {
   int pos = delegate.positionWriter(index);
   try {
     writeBytes(src, length);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #7
0
 @Override
 public void setBytes(int index, ByteBuffer src) {
   int pos = delegate.positionWriter(index);
   try {
     writeBytes(src);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #8
0
 @Override
 public float getFloat(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readFloat();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #9
0
 @Override
 public double getDouble(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readDouble();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #10
0
 @Override
 public long getLong(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readLong();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #11
0
 @Override
 public char getChar(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readChar();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #12
0
 @Override
 public long getUnsignedInt(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readUnsignedInt();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #13
0
 @Override
 public int getUnsignedMedium(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readUnsignedMedium();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #14
0
 @Override
 public short getShort(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readShort();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #15
0
 @Override
 public void setFloat(int index, float value) {
   int pos = delegate.positionWriter(index);
   try {
     writeFloat(value);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #16
0
 @Override
 public void getBytes(int index, ChannelBuffer dst, int length) {
   int pos = delegate.positionReader(index);
   try {
     readBytes(dst, length);
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #17
0
 @Override
 public void setDouble(int index, double value) {
   int pos = delegate.positionWriter(index);
   try {
     writeDouble(value);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #18
0
 @Override
 public void getBytes(int index, byte[] dst, int dstIndex, int length) {
   int pos = delegate.positionReader(index);
   try {
     readBytes(dst, dstIndex, length);
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #19
0
 @Override
 public void setBytes(int index, byte[] src, int srcIndex, int length) {
   int pos = delegate.positionWriter(index);
   try {
     writeBytes(src, srcIndex, length);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #20
0
 @Override
 public void getBytes(int index, ByteBuffer dst) {
   int pos = delegate.positionReader(index);
   try {
     readBytes(dst);
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #21
0
 @Override
 public int setBytes(int index, InputStream in, int length) throws IOException {
   int pos = delegate.positionWriter(index);
   try {
     return writeBytes(in, length);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #22
0
 @Override
 public void setChar(int index, int value) {
   int pos = delegate.positionWriter(index);
   try {
     writeChar(value);
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #23
0
 @Override
 public byte getByte(int index) {
   int pos = delegate.positionReader(index);
   try {
     return readByte();
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #24
0
 @Override
 public void writeChar(int value) {
   try {
     delegate.put((byte) value);
     delegate.put((byte) (value >>> 8));
   } catch (IOException e) {
     throw writeException(e);
   }
 }
Example #25
0
 @Override
 public void writeMedium(int value) {
   try {
     delegate.putShort((short) value);
     delegate.put((byte) (value >>> 16));
   } catch (IOException e) {
     throw writeException(e);
   }
 }
Example #26
0
 @Override
 public char readChar() {
   try {
     short low = delegate.get();
     short high = delegate.get();
     return (char) (low | (high << 8));
   } catch (ReadPastEndException e) {
     throw outOfBounds(e);
   }
 }
Example #27
0
 @Override
 public int readMedium() {
   try {
     int low = delegate.getShort();
     int high = delegate.get();
     return low | (high << 16);
   } catch (ReadPastEndException e) {
     throw outOfBounds(e);
   }
 }
Example #28
0
 @Override
 public void setZero(int index, int length) {
   int pos = delegate.positionWriter(index);
   try {
     for (int i = 0; i < length; i++) {
       writeByte(0);
     }
   } finally {
     delegate.positionWriter(pos);
   }
 }
Example #29
0
 @Override
 public int indexOf(int fromIndex, int toIndex, byte value) {
   int pos = delegate.positionReader(fromIndex);
   try {
     while (delegate.readerPosition() < toIndex) {
       int thisPos = delegate.readerPosition();
       if (delegate.get() == value) {
         return thisPos;
       }
     }
     return -1;
   } catch (ReadPastEndException e) {
     throw new RuntimeException(e);
   } finally {
     delegate.positionReader(pos);
   }
 }
Example #30
0
 @Override
 public void writeBytes(byte[] src) {
   try {
     delegate.put(src, src.length);
   } catch (IOException e) {
     throw writeException(e);
   }
 }