List of usage examples for org.apache.hadoop.hdfs DFSInputStream read
@Override
public synchronized int read(final ByteBuffer buf) throws IOException
From source file:org.segrada.service.binarydata.BinaryDataServiceHadoop.java
License:Apache License
@Override public byte[] getBinaryData(String id) throws IOException { if (!referenceExists(id)) return null; DFSInputStream fis = client.open(rootPath + id); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; for (int readNum; (readNum = fis.read(buf)) != -1;) { bos.write(buf, 0, readNum);//from w w w . j a va 2 s.c om } return bos.toByteArray(); }