comparison src/org/eclipse/jetty/io/ByteArrayBuffer.java @ 1030:80cad9086593

remove Buffer.isVolatile()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 01:10:09 -0600
parents 4e5e9e3c25b3
children b71ad168fe34
comparison
equal deleted inserted replaced
1029:4e5e9e3c25b3 1030:80cad9086593
31 // Set a maximum size to a write for the writeTo method, to ensure that very large content is not 31 // Set a maximum size to a write for the writeTo method, to ensure that very large content is not
32 // written as a single write (which may fall foul to write timeouts if consumed slowly). 32 // written as a single write (which may fall foul to write timeouts if consumed slowly).
33 final static int MAX_WRITE=Integer.getInteger("org.eclipse.jetty.io.ByteArrayBuffer.MAX_WRITE",128*1024); 33 final static int MAX_WRITE=Integer.getInteger("org.eclipse.jetty.io.ByteArrayBuffer.MAX_WRITE",128*1024);
34 final protected byte[] _bytes; 34 final protected byte[] _bytes;
35 35
36 protected ByteArrayBuffer(int size, int access, boolean isVolatile) 36 protected ByteArrayBuffer(int size, int access)
37 { 37 {
38 this(new byte[size],0,0,access, isVolatile); 38 this(new byte[size],0,0,access);
39 } 39 }
40 40
41 public ByteArrayBuffer(byte[] bytes) 41 public ByteArrayBuffer(byte[] bytes)
42 { 42 {
43 this(bytes, 0, bytes.length, READWRITE); 43 this(bytes, 0, bytes.length, READWRITE);
48 this(bytes, index, length, READWRITE); 48 this(bytes, index, length, READWRITE);
49 } 49 }
50 50
51 public ByteArrayBuffer(byte[] bytes, int index, int length, int access) 51 public ByteArrayBuffer(byte[] bytes, int index, int length, int access)
52 { 52 {
53 super(READWRITE, NON_VOLATILE); 53 super(READWRITE);
54 _bytes = bytes; 54 _bytes = bytes;
55 setPutIndex(index + length); 55 setPutIndex(index + length);
56 setGetIndex(index); 56 setGetIndex(index);
57 _access = access; 57 _access = access;
58 } 58 }
59 59
60 private ByteArrayBuffer(byte[] bytes, int index, int length, int access, boolean isVolatile)
61 {
62 super(READWRITE, isVolatile);
63 _bytes = bytes;
64 setPutIndex(index + length);
65 setGetIndex(index);
66 _access = access;
67 }
68
69 public ByteArrayBuffer(int size) 60 public ByteArrayBuffer(int size)
70 { 61 {
71 this(new byte[size], 0, 0, READWRITE); 62 this(new byte[size], 0, 0, READWRITE);
72 setPutIndex(0); 63 setPutIndex(0);
73 } 64 }
74 65
75 public ByteArrayBuffer(String value) 66 public ByteArrayBuffer(String value)
76 { 67 {
77 super(READWRITE,NON_VOLATILE); 68 super(READWRITE);
78 _bytes = StringUtil.getBytes(value); 69 _bytes = StringUtil.getBytes(value);
79 setGetIndex(0); 70 setGetIndex(0);
80 setPutIndex(_bytes.length); 71 setPutIndex(_bytes.length);
81 _access=IMMUTABLE; 72 _access=IMMUTABLE;
82 _string = value; 73 _string = value;