PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.1-rc2/hive/external/serde/src/java/org/apache/hadoop/hive/serde2/ByteStream.java

#
Java | 83 lines | 42 code | 12 blank | 29 comment | 0 complexity | 73a3fade8cdd2184bccf0e4972f19ab0 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. package org.apache.hadoop.hive.serde2;
  19. import org.apache.hadoop.hive.common.io.NonSyncByteArrayInputStream;
  20. import org.apache.hadoop.hive.common.io.NonSyncByteArrayOutputStream;
  21. /**
  22. * Extensions to bytearrayinput/output streams.
  23. *
  24. */
  25. public class ByteStream {
  26. /**
  27. * Input.
  28. *
  29. */
  30. public static class Input extends NonSyncByteArrayInputStream {
  31. public byte[] getData() {
  32. return buf;
  33. }
  34. public int getCount() {
  35. return count;
  36. }
  37. public void reset(byte[] argBuf, int argCount) {
  38. buf = argBuf;
  39. mark = pos = 0;
  40. count = argCount;
  41. }
  42. public Input() {
  43. super(new byte[1]);
  44. }
  45. public Input(byte[] buf) {
  46. super(buf);
  47. }
  48. public Input(byte[] buf, int offset, int length) {
  49. super(buf, offset, length);
  50. }
  51. }
  52. /**
  53. * Output.
  54. *
  55. */
  56. public static class Output extends NonSyncByteArrayOutputStream {
  57. @Override
  58. public byte[] getData() {
  59. return buf;
  60. }
  61. public int getCount() {
  62. return count;
  63. }
  64. public Output() {
  65. super();
  66. }
  67. public Output(int size) {
  68. super(size);
  69. }
  70. }
  71. }