FileEntry extends VirtualFileEntry { public byte[] contentAsBytes() throws IOException, ServerException { final ContentStream contentStream = getContentStream(); final int contentLength = (int)contentStream.getLength(); if (contentLength == 0) { return new byte[0]; } try (InputStream stream = contentStream.getStream()) { if (contentLength < 0) { return ByteStreams.toByteArray(stream); } final byte[] b = new byte[contentLength]; ByteStreams.readFully(stream, b); return b; } } FileEntry(String workspace, VirtualFile virtualFile); @Override FileEntry copyTo(String newParent); @Override FileEntry copyTo(String newParent, String newName, boolean override); @Override void moveTo(String newParent); @Override void moveTo(String newParent, String name, boolean overWrite); String getMediaType(); void setMediaType(String mediaType); InputStream getInputStream(); byte[] contentAsBytes(); void updateContent(byte[] content, String mediaType); void updateContent(byte[] content); void updateContent(InputStream content); void updateContent(InputStream content, String mediaType); void rename(String newName, String newMediaType);  }
@Test public void testGetContent() throws Exception { Assert.assertEquals(myFile.contentAsBytes(), "to be or not to be".getBytes()); }